-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Animation for sprites -- -- Prototypical sprite animation with type-safety. @package animate @version 0.1.0 module Data.Animate -- | Avoided newtype wrapper for convenience (tentative) type Seconds = Float -- | Type aliased seconds (tentative) type DeltaSeconds = Seconds data Frame loc Frame :: loc -> Seconds -> Frame loc -- | Type safe animation set. Use an sum type with an Enum and -- Bounded instance for the animation, a. data Animations a loc -- | Generate animations given each constructor animations :: (Enum a, Bounded a) => (a -> [Frame loc]) -> Animations a loc -- | Lookup the frames of an animation framesByAnimation :: Enum a => Animations a loc -> a -> Vector (Frame loc) data Loop -- | Never stop looping. Animation can never be completed. Loop'Forever :: Loop -- | Count down loops to below zero. 0 = no loop. 1 = one loop. 2 = two -- loops. etc. Loop'Count :: Int -> Loop -- | State for progression through an animation data Position a Position :: a -> Int -> Seconds -> Loop -> Position a -- | You can ignore. An intermediate type for stepAnimation to judge -- how to increment the current frame. data FrameStep -- | New counter to compare against the frame's delay. FrameStep'Counter :: Seconds -> FrameStep -- | How much delta to carry over into the next frame. FrameStep'Delta :: DeltaSeconds -> FrameStep -- | Intermediate function for how a frame should be step through. stepFrame :: Frame loc -> Position a -> DeltaSeconds -> FrameStep -- | Step through the animation resulting in a new position. stepAnimation :: Enum a => Animations a loc -> Position a -> DeltaSeconds -> Position a -- | 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. isAnimationComplete :: Enum a => Animations a loc -> Position a -> Bool -- | Simple function diff'ing the position for loop change (tentative) positionHasLooped :: Position a -> Position a -> Bool instance GHC.Classes.Eq Data.Animate.FrameStep instance GHC.Show.Show Data.Animate.FrameStep instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Animate.Position a) instance GHC.Show.Show a => GHC.Show.Show (Data.Animate.Position a) instance GHC.Classes.Eq Data.Animate.Loop instance GHC.Show.Show Data.Animate.Loop instance GHC.Classes.Eq loc => GHC.Classes.Eq (Data.Animate.Animations a loc) instance GHC.Show.Show loc => GHC.Show.Show (Data.Animate.Animations a loc) instance GHC.Classes.Eq loc => GHC.Classes.Eq (Data.Animate.Frame loc) instance GHC.Show.Show loc => GHC.Show.Show (Data.Animate.Frame loc)