Introduction
An Animation is a class that implements a temporary user interaction in a view. Examples of common animations are:
Animation | Usage |
InsertAnimation | Insert a Snapper, including positioning it and snapping to other objects. |
DragAnimation | Move the selection. |
StretchAnimation | Stretch Snappers, for instance, change width or height with a dragging gesture. |
Move3DAnimation | Pan in a 2D view. |
Rotate3DAnimation | Pan, move or circle target in a 3D view. |
SnapClickAnimation | Disconnect Snappers. |
An Animation takes over the normal behavior of the program while it's running. For instance, when you are inserting a Snapper, clicking somewhere normally means to place/drop the Snapper being inserted. When no Animation is running, clicking in a view selects what you click on.
Implementations
The most common implementations are automatic by overriding Snapper's animation methods:
insertAnimation()
leftDragAnimation()
rotateAnimation()
- etc. methods that return Animation
There are also times you want users to select something in the library toolbox to start an Animation, and for that, you use the AnimationLimb class.
For any other uses, the best way would be to use animate()
in cm/core/animationStack.cm.
Noteworthy Things You Can Customize
Mouse Information
As the main purpose of an Animation is to use an intuitive method of manipulation using mostly the mouse, you can extract mouse information to customize what you want to do based on this information.
Multiple Stage Animation
If you have an idea to make an input that has multiple stages (i.e. First click it to set a coordinate, Second click to place a stretched coordinate point of a wall). You can refer to SpawningAnimation.
Multiple Snappers
If in some situations you need to manipulate multiple Snappers in one Animation (i.e. Inserting multiple Snappers in a single InsertAnimation), you can add the Snappers with appending using <<.
Core Properties
If the Animation is G2, you can implement Core Properties into your custom Animation object. For more information, refer to the Core Properties article.
Graphics in Animation
Placing graphics into an Animation can assist in improving the intuitive understanding while using a custom Animation. This can be done by overriding the drawGraphs()
/get3D()
method in the Animation class.
Others
Most Animations that are G2 will be implemented from CoreAnimation, therefore reading through the class's methods can give you a more updated and detailed picture of what can be customized.
Comments
0 comments
Please sign in to leave a comment.