Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Seconds = Float
- type DeltaSeconds = Seconds
- data Frame loc = Frame loc Seconds
- data Animations a loc
- animations :: (Enum a, Bounded a) => (a -> [Frame loc]) -> Animations a loc
- framesByAnimation :: Enum a => Animations a loc -> a -> Vector (Frame loc)
- data Loop
- data Position a = Position a Int Seconds Loop
- data FrameStep
- stepFrame :: Frame loc -> Position a -> DeltaSeconds -> FrameStep
- stepAnimation :: Enum a => Animations a loc -> Position a -> DeltaSeconds -> Position a
- isAnimationComplete :: Enum a => Animations a loc -> Position a -> Bool
- positionHasLooped :: Position a -> Position a -> Bool
Documentation
type DeltaSeconds = Seconds Source #
Type aliased seconds (tentative)
data Animations a loc Source #
Eq loc => Eq (Animations a loc) Source # | |
Show loc => Show (Animations a loc) Source # | |
animations :: (Enum a, Bounded a) => (a -> [Frame loc]) -> Animations a loc Source #
Generate animations given each constructor
framesByAnimation :: Enum a => Animations a loc -> a -> Vector (Frame loc) Source #
Lookup the frames of an animation
Loop'Forever | Never stop looping. Animation can never be completed. |
Loop'Count Int | Count down loops to below zero. 0 = no loop. 1 = one loop. 2 = two loops. etc. |
State for progression through an animation
You can ignore. An intermediate type for stepAnimation
to judge how to increment the current frame.
FrameStep'Counter Seconds | New counter to compare against the frame's delay. |
FrameStep'Delta DeltaSeconds | How much delta to carry over into the next frame. |
stepFrame :: Frame loc -> Position a -> DeltaSeconds -> FrameStep Source #
Intermediate function for how a frame should be step through.
stepAnimation :: Enum a => Animations a loc -> Position a -> DeltaSeconds -> Position a Source #
Step through the animation resulting in a new position.
isAnimationComplete :: Enum a => Animations a loc -> Position a -> Bool Source #
The animation has finished all its frames. Useful for signalling into switching to another animation. With a Loop'Forever, the animation will never be completed.