admin管理员组

文章数量:1317915

I understand how JS is run and I think I understand most of the DOM but I've no idea about animation. Does anybody here know of a good guide that can explain to me how it's done in Javascript?

In addition, should I even consider Javascript for animation? Should I instead be looking to learn flash?

I understand how JS is run and I think I understand most of the DOM but I've no idea about animation. Does anybody here know of a good guide that can explain to me how it's done in Javascript?

In addition, should I even consider Javascript for animation? Should I instead be looking to learn flash?

Share Improve this question asked Aug 13, 2008 at 16:26 TeifionTeifion 111k76 gold badges164 silver badges196 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

Avoid flash, its a horrible requirement, uncrawlable by Google, unsopported by a bunch of browsers and systems (eg iPhone) and most importantly: it forces you to reinvent web standards (e.g. scroll bars and whatnot), Javascript on the other hand is easier to maintain and code for in the noscript case.

try scriptaculous for your animations;

  • here's a quickie 3-line tutorial so you can see it working
  • here's a more plete tutorial
  • here's the scriptaculous wiki

note that there are a gazillion JS animation libraries, some really good jQuery es to mind. Usually they're just a script tag and an onclick event to setup.

Good luck!

/mp

if your animation is simple, change colors over time, move from x to y in 3 seconds. Javascript is fine. If you want all kinds of wizbang buttons and coordinated rotation of the screen, straight up js + dhtml will be clunky at best. Silverlight vs Flash are you questions at that point. Interestingly enough, you program Silverlight with javascript, and that would be the major benefit to simply upgrading to a faster and more dynamic DOM that is implemented in Silverlight but still writing the same code. Flash programmability is very limited in my experience, you can do anything, but it will be slow and take thousands of lines of code to get there. For simple JS animations look at jQuery or Scriptaculous.

Check out a JS animation framework like Bernard Sumption's Animator.js. It's pretty light-weight and has some excellent examples.

Personally, I wouldn't be animating things in JS. Flash FTW.

If you aren't concerned with IE support, you could also try experimenting with the canvas element:

MOZILLA DEVELOPER NETWORK Basic animations

本文标签: Animation in javascripta starting pointStack Overflow