Things related to animation. More...
Classes | |
class | Animated |
something that can be automatically moved, spun or resized over time. More... | |
class | IAnimationHelper |
helper for add-on or complex motion during animation More... | |
class | Offset |
offset within a 2D coordinate system More... | |
class | Point |
point for 2D coordinate system More... | |
class | Quad |
4 point polygon in 2D system More... | |
class | Rect |
Rectangle for 2D coordinate system. More... | |
class | RotatedRect |
rectangle with rotation for 2D coordinate system. More... | |
class | Sprite |
animated, moving image that is automatically moved, animated, and drawn More... | |
struct | SpriteAnimateEvent |
a Sprite did some animation (Optional) More... | |
class | SpriteLayer |
creates and tracks collections of sprites More... | |
class | Vector |
vector (magnitude and direction) within a 2D coordinate system. More... | |
Variables | |
const | action_AnimationComplete = 47 |
eventType_SpriteLayer action: all animations for every SpriteLayer have completed More... | |
const | action_AnimationEnd = 9 |
eventType_SpriteAnimate action: a sprite animation has completed More... | |
const | action_AnimationLoop = 8 |
eventType_SpriteAnimate action: a sprite animation has completed and is looping back to the start More... | |
const | action_AnimationStart = 44 |
eventType_SpriteLayer action: starting animations for all SpriteLayers More... | |
const | action_ExitLayer = 4 |
eventType_SpriteAnimate action: a sprite has moved outside the layer boundaries. More... | |
const | action_FadeComplete = 10 |
eventType_SpriteAnimate action: a sprite fadeTo() has completed More... | |
const | action_FadeInComplete = 11 |
eventType_SpriteAnimate action: a sprite fade-in has completed More... | |
const | action_FadeOutComplete = 12 |
eventType_SpriteAnimate action: a sprite fade-out has completed More... | |
const | action_LayerFadeInComplete = 49 |
eventType_SpriteLayer action: the fade-in of a layer has been completed More... | |
const | action_LayerFadeOutComplete = 50 |
eventType_SpriteLayer action: the fade-out of a layer has been completed More... | |
const | action_Offscreen = 2 |
eventType_SpriteAnimate action: a sprite has gone completely offscreen (GUI Only) More... | |
const | action_Onscreen = 3 |
eventType_SpriteAnimate action: a sprite that was off screen has moved onscreen (GUI Only) More... | |
const | action_PostAnimateLayer = 46 |
eventType_SpriteLayer action: all animations for a particular SpriteLayer have completed More... | |
const | action_PreAnimateLayer = 45 |
eventType_SpriteLayer action: about to start animations for a particular SpriteLayer More... | |
const | action_ZoomComplete = 48 |
eventType_SpriteLayer action: zooming a particular sprite layer is complete More... | |
Things related to animation.
class pdg::IAnimationHelper |
helper for add-on or complex motion during animation
Implement this interface to do extra animation stuff for a specific Animated object then add by calling the object's addAnimationHelper() method. You can have multiple Animation Helpers attached to the same object. Your helper will then be called every time movement for the object is calculated.
To create a helper:
If you need something more complex, you can also use classify to create a new Javascript class that derives from pdg.IAnimationHelper, and it will call the animated() method of your class. For example:
As you can see from the examples above, your Animation Helper function (or animate() method) will be called with two parameters, and return a boolean:
what | the Animated object that is being animated |
msElapsed | the number of milliseconds that have elapsed since the last time this object's movement was calculated |
struct pdg::SpriteAnimateEvent |
a Sprite did some animation (Optional)
A Sprite will generate one of these events when it completes an animation including fades (opacity animations), and moving on/offscreen or outside of the layer.
For frame based animations – that is, calls to Sprite.startFrameAnimation() – if it reaches the last frame and is not set to loop, action will be action_AnimationEnd. For looping animations action_AnimationLoop will be received each time the animation completes and starts over with the first frame.
For fades, one of three action types are possible: action_FadeComplete for calls to Sprite.fadeTo(), action_FadeInComplete for calls to Sprite.fadeIn(), and action_FadeOutComplete for calls to Sprite.fadeOut().
When a Sprite has setWantsOffscreenEvents(true), action_Offscreen and action_Onscreen events will be generated for that sprite whenever it enters or departs the visible area of the port the layer is being rendered into.
When a Sprite has setWantsCollideWallEvents(true), action_ExitLayer events will be generated for that sprite whenever it moves completely outside the boundaries of the layer. (It will also get a SpriteCollideEvent when hits the boundary).
{ emitter: {}, // the emitter that generated this event eventType: 17, // the event type (eventType_SpriteAnimate) action: 0, // what happened (action_AnimationEnd/Loop or action_Fade/In/OutComplete) actingSprite: {}, // the Sprite that was animating inLayer: {} // the SpriteLayer that contains the Sprite }
action_AnimationComplete = 47 |
eventType_SpriteLayer action: all animations for every SpriteLayer have completed
Emitted once per animation step, after all animation has completed.
action_AnimationEnd = 9 |
eventType_SpriteAnimate action: a sprite animation has completed
action_AnimationLoop = 8 |
eventType_SpriteAnimate action: a sprite animation has completed and is looping back to the start
action_AnimationStart = 44 |
eventType_SpriteLayer action: starting animations for all SpriteLayers
Emitted once per animation step, before any animation is done.
action_ExitLayer = 4 |
eventType_SpriteAnimate action: a sprite has moved outside the layer boundaries.
These events are only generated for sprites that have setWantsCollideWallEvents(true) called for them, and that the SpriteLayer that holds the sprite has had its size explicitly set.
action_FadeComplete = 10 |
eventType_SpriteAnimate action: a sprite fadeTo() has completed
action_FadeInComplete = 11 |
eventType_SpriteAnimate action: a sprite fade-in has completed
action_FadeOutComplete = 12 |
eventType_SpriteAnimate action: a sprite fade-out has completed
action_LayerFadeInComplete = 49 |
eventType_SpriteLayer action: the fade-in of a layer has been completed
action_LayerFadeOutComplete = 50 |
eventType_SpriteLayer action: the fade-out of a layer has been completed
action_Offscreen = 2 |
eventType_SpriteAnimate action: a sprite has gone completely offscreen (GUI Only)
This event is only generated for sprites that have setWantsOffscreenEvents(true) called.
action_Onscreen = 3 |
eventType_SpriteAnimate action: a sprite that was off screen has moved onscreen (GUI Only)
These events are only generated for sprites that have setWantsOffscreenEvents(true) called for them.
action_PostAnimateLayer = 46 |
eventType_SpriteLayer action: all animations for a particular SpriteLayer have completed
Emitted once per layer per animation step, after all animation for the layer is complete.
action_PreAnimateLayer = 45 |
eventType_SpriteLayer action: about to start animations for a particular SpriteLayer
Emitted once per layer per animation step, before any animation for that layer is performed.
action_ZoomComplete = 48 |
eventType_SpriteLayer action: zooming a particular sprite layer is complete