helm-0.4: A functionally reactive game engine.

Safe HaskellNone

FRP.Helm.Animation

Contents

Description

Contains all data structures and functions for creating and stepping animations.

Synopsis

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.

newtype Animation Source

A type describing an animation consisting of a list of frames.

Constructors

Animation [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. The list of frames should never be empty.

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. The list of frames should never be empty.

 relative [(100, picture1), (100, picture2), (300, picture3)] == absolute [(100, picture1), (200, picture2), (500, picture3)]

Animating

animate :: Animation -> SignalGen (Signal Time) -> SignalGen (Signal Bool) -> SignalGen (Signal Form)Source

Creates a signal contained in a generator that returns the current form in the animation when sampled from a specific animation. The second argument is a signal generator containing a signal that returns the time to setup the animation forward when sampled. The third argument is a signal generator containing a signal that returns true to continue animating or false to stop animating when sampled.

formAt :: Animation -> Time -> FormSource

The form that will be rendered for a specific time in an animation.

length :: Animation -> TimeSource

The amount of time one cycle of the animation takes.