diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/examples/anim/alt-iterations.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/examples/anim/alt-iterations.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,298 @@ + + + + + YUI Library Examples: Animation: Alternating Iterations + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

+
+ + +
+ + + +
+
+
+
+

YUI Library Examples: Animation: Alternating Iterations

+
+
+ +

Note: This is YUI 3.x. Looking for YUI 2.x?

+ +
+
+
+
+ +

Animation: Alternating Iterations

+ +
+

+

This demonstrates how to use the iterations attribute to run multiple iterations of the animation.

+

Mouse over the link to begin the animation.

+ +

+ +
+
+ + + + + +hover me + + + + + +
+
+
+ +

Setting up the HTML

+

First we add some HTML to animate.

+ + +

Creating the Anim Instance

+

Now we create an instance of Y.Anim, passing it a configuration object that includes the node we wish to animate and the to attribute containing the final properties and their values.

+

Adding an iterations attribute of "infinite" means that the animation will run continuously.

+

The direction attribute of "alternate" means that the animation reverses every other iteration.

+ + + +

Changing Attributes

+

We don't want the animation running when the link is not hovered over, so we will change the animation attributes depending on whether or not we are over the link.

+

We can use a single handler for both mouse the mouseOver and mouseOut events, and set the reverse attribute depending on which event fired.

+ +

Running the Animation

+

Finally we add event handlers to run the animation.

+ + +

Full Script Source

+ + +
+ +
+ +
+
+ + + +
+ +
+

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

Privacy Policy - + Terms of Service - + Copyright Policy - + Job Openings

+
+
+ + + +