Safe Haskell | None |
---|
Contains all data structures and functions for creating and stepping animations.
- type Frame = (Time, Form)
- type Animation = [Frame]
- data AnimationStatus
- absolute :: [Frame] -> Animation
- relative :: [Frame] -> Animation
- animate :: Animation -> SignalGen (Signal Time) -> SignalGen (Signal AnimationStatus) -> SignalGen (Signal Form)
- formAt :: Animation -> Time -> Maybe Form
- length :: Animation -> Time
Types
type Frame = (Time, Form)Source
A type describing a single frame in an animation. A frame consists of a time at which the frame takes place in an animation and the form which is how the frame actually looks when rendered.
data AnimationStatus Source
A data structure that can be used to manage the status of the animation.
Cycle | The animation continues to play through its frames. |
Pause | The animation is paused. |
Stop | The animation is stopped, jumping back to the first frame and initial time. |
SetFrame Int | The animation is set to a specific one-indexed frame. |
SetTime Time | The animation is set to a specific time and its related frame. |
Creating
absolute :: [Frame] -> AnimationSource
Creates an animation from a list of frames. The time value in each frame is absolute to the entire animation, i.e. each time value is the time at which the frame takes place relative to the starting time of the animation.
relative :: [Frame] -> AnimationSource
Creates an animation from a list of frames. The time value in each frame is relative to other frames, i.e. each time value is the difference in time from the last frame.
relative [(100 * millisecond, picture1), (100 * millisecond, picture2)] == absolute [(100 * millisecond, picture1), (200 * millisecond, picture2)]
Animating
animate :: Animation -> SignalGen (Signal Time) -> SignalGen (Signal AnimationStatus) -> SignalGen (Signal Form)Source
Creates a signal that returns the current form in the animation when sampled from a specific animation. The second argument is a signal that returns the time to setup the animation forward when sampled. The third argument is a signal that returns the status of the animation, allowing you to control it.