|
||
| Inside Technique : Animation Toolkit : Manipulating Paths By themselves, the path objects are nothing more than a very simple animation. Most of the time you are gong to want to create more complete animations by combining multiple paths together into new paths. Each Path object exposes three methods for working with and transposing path objects. All these methods return a new path. concat MethodThe concat method is used for sequencing multiple path objects together.
The concat() method has one argument, the path to concatenate to the current path and returns
the new path object:
add MethodThe add method is useful for moving a path. The path methods adds the specified
path's x and y values to the current path:
rotate MethodThe rotate method makes it easy to rotate the current around a specified point. This
is useful if you create an animation and just want to change its orientation on the screen.
Running the AnimationSo far you have seen how to choreograph the path. You have not yet seen how
to associate the path with a particular object nor how to actually start an animation.
We call this next step directing the animation and use the Animator object to
associate a path with an object on the screen. The Animator
object takes the string ID of the element to animate, the path object the element will follow, and
the amount of time to wait between each step:
The Animator object also supports an event, onanimationdone, that occurs when the entire path has been traversed. Now you have an animation object. The animation object exposes three methods for controlling the execution of the animation: play(), pause(), and stop(). Next we take you through a simple demonstration of creating paths and using the Animator object. Page 1:Animation Toolkit © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |