Inheritance diagram for ComponentAnimator:

To use this, create a ComponentAnimator, and use its animateComponent() method to tell it to move components to destination positions. Any number of components can be animated by one ComponentAnimator object (if you've got a lot of components to move, it's much more efficient to share a single animator than to have many animators running at once).
You'll need to make sure the animator object isn't deleted before it finishes moving the components.
Public Member Functions | |
| ComponentAnimator () | |
| Creates a ComponentAnimator. | |
| ~ComponentAnimator () | |
| Destructor. | |
| void | animateComponent (Component *const component, const Rectangle &finalPosition, const int millisecondsToSpendMoving, const double startSpeed=1.0, const double endSpeed=1.0) |
| Starts a component moving from its current position to a specified position. | |
| void | cancelAnimation (Component *const component, const bool moveComponentToItsFinalPosition) |
| Stops a component if it's currently being animated. | |
| void | cancelAllAnimations (const bool moveComponentsToTheirFinalPositions) |
| Clears all of the active animations. | |
| const Rectangle | getComponentDestination (Component *const component) |
| Returns the destination position for a component. | |
|
|
Creates a ComponentAnimator.
|
|
|
Destructor.
|
|
||||||||||||||||||||||||
|
Starts a component moving from its current position to a specified position. If the component is already in the middle of an animation, that will be abandoned, and a new animation will begin, moving the component from its current location. The start and end speed parameters let you apply some acceleration to the component's movement.
|
|
||||||||||||
|
Stops a component if it's currently being animated. If moveComponentToItsFinalPosition is true, then the component will be immediately moved to its destination position and size. If false, it will be left in whatever location it currently occupies. |
|
|
Clears all of the active animations. If moveComponentsToTheirFinalPositions is true, all the components will be immediately set to their final positions. If false, they will be left in whatever locations they currently occupy. |
|
|
Returns the destination position for a component. If the component is being animated, this will return the target position that was specified when animateComponent() was called. If the specified component isn't currently being animated, this method will just return its current position. |