Animation Utility: Animating XY Position
This demonstrates how to animate the
xy position of an element.
Click anywhere to move the element to your click position.
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. We will set the
to attribute later when then animation runs.
Next we need a
click handler to set the
to attribute for the
xy behavior and run the animation.
Running the Animation
Finally we add an event handler to run the animation when the document is clicked.