| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Reanimate.Animation
Synopsis
- type Duration = Double
- type Time = Double
- type SVG = Tree
- data Animation = Animation Duration (Time -> SVG)
- mkAnimation :: Duration -> (Time -> SVG) -> Animation
- animate :: (Time -> SVG) -> Animation
- duration :: Animation -> Duration
- seqA :: Animation -> Animation -> Animation
- parA :: Animation -> Animation -> Animation
- parLoopA :: Animation -> Animation -> Animation
- parDropA :: Animation -> Animation -> Animation
- pause :: Duration -> Animation
- andThen :: Animation -> Animation -> Animation
- frameAt :: Double -> Animation -> Tree
- renderTree :: Tree -> String
- renderSvg :: Maybe Number -> Maybe Number -> Tree -> String
- mapA :: (Tree -> Tree) -> Animation -> Animation
- pauseAtEnd :: Duration -> Animation -> Animation
- pauseAtBeginning :: Duration -> Animation -> Animation
- pauseAround :: Duration -> Duration -> Animation -> Animation
- pauseUntil :: Duration -> Animation -> Animation
- freezeFrame :: Double -> Animation -> Time -> SVG
- adjustDuration :: (Duration -> Duration) -> Animation -> Animation
- setDuration :: Duration -> Animation -> Animation
- reverseA :: Animation -> Animation
- playThenReverseA :: Animation -> Animation
- repeatA :: Double -> Animation -> Animation
- freezeAtPercentage :: Time -> Animation -> Animation
- signalA :: Signal -> Animation -> Animation
Documentation
Animations are SVGs over a finite time.
seqA :: Animation -> Animation -> Animation Source #
Play animations in sequence. The lhs animation is removed after it has
   completed. New animation duration is 'duration lhs + duration rhs'.
Example:
drawBox `seqA` drawCircle

parA :: Animation -> Animation -> Animation Source #
Play two animation concurrently. Shortest animation freezes on last frame.
   New animation duration is 'max (duration lhs) (duration rhs)'.
Example:
drawBox `parA` adjustDuration (*2) drawCircle

parLoopA :: Animation -> Animation -> Animation Source #
Play two animation concurrently. Shortest animation loops.
   New animation duration is 'max (duration lhs) (duration rhs)'.
Example:
drawBox `parLoopA` adjustDuration (*2) drawCircle

parDropA :: Animation -> Animation -> Animation Source #
Play two animation concurrently. Animations disappear after playing once.
   New animation duration is 'max (duration lhs) (duration rhs)'.
Example:
drawBox `parLoopA` adjustDuration (*2) drawCircle

pause :: Duration -> Animation Source #
Empty animation (no SVG output) with a fixed duration.
Example:
pause 1 `seqA` drawProgress

andThen :: Animation -> Animation -> Animation Source #
Play left animation and freeze on the last frame, then play the right
   animation. New duration is 'duration lhs + duration rhs'.
Example:
drawBox `andThen` drawCircle

renderTree :: Tree -> String Source #
mapA :: (Tree -> Tree) -> Animation -> Animation Source #
Map over the SVG produced by an animation at every frame.
Example:
mapA (scale 0.5) drawCircle

pauseAtEnd :: Duration -> Animation -> Animation Source #
Freeze the last frame for t seconds at the end of the animation.
Example:
pauseAtEnd 1 drawProgress

pauseAtBeginning :: Duration -> Animation -> Animation Source #
Freeze the first frame for t seconds at the beginning of the animation.
Example:
pauseAtBeginning 1 drawProgress

pauseAround :: Duration -> Duration -> Animation -> Animation Source #
Freeze the first and the last frame of the animation for a specified duration.
Example:
pauseAround 1 1 drawProgress

adjustDuration :: (Duration -> Duration) -> Animation -> Animation Source #
Change the duration of an animation. Animates are stretched or squished (rather than truncated) to fit the new duration.
setDuration :: Duration -> Animation -> Animation Source #
Set the duration of an animation by adjusting its playback rate. The animation is still played from start to finish without being cropped.
playThenReverseA :: Animation -> Animation Source #
Play animation before playing it again in reverse. Duration is twice the duration of the input.
Example:
playThenReverseA drawCircle



