nibrivia/animator/1.2.0

NOTE: the latest version is 2.0.0

Animator

Create an animation

type Animation a

The core animation type

Create a constant animation of 0-duration

withUnitBounds : (Float -> a) -> Animation a

Probably what wants to be used by default, expects an animation from 0 to 1.

withDuration : Float -> (Float -> a) -> Animation a

Most general constructor for an Animation.

Run the animation

render : Float -> Animation a -> a

Actually "runs" the animation at the given time.

Get information about an animation

duration : Animation a -> Float

Get the duration of an existing animation

Get the final state of an existing animation

Modify an animation

Initial and final states

Force the animation's initial value to the given argument

Force the animation's final value to the given argument

Force the animation's initial and final values to the given argument

Force the animation's initial and final values to what they would be at the start and end.

By default, animations can "leak" out of their bounds. This makes it so that when the animation is rendered "beyond" its bounds, it "holds" the value it ends with.

Modifications of individual animations

Reverse the animation entirely

Sets an duration of Infinity and forever loops the animation

delay : Float -> Animation a -> Animation a

Delays the start of an animation by the given time

cutAt : Float -> Animation a -> Animation a

Effectively sets the duration of the animation to be shorter.

This might not behave how you expect it: animations can keep going past their end, you might want to use freezeAfter if you want the animation to actually stop.

freezeAfter : Float -> Animation a -> Animation a

Stops the animation after the given time.

speedup : Float -> Animation a -> Animation a

Speeds up the animation by a desired factor

fitIn : Float -> Animation a -> Animation a

Speeds up the animation to fit within the given time

mapRes : (a -> b) -> Animation a -> Animation b

Modifies the output of the animation

Compose animations

Just two animations

Takes two animations and plays them one after the other.

The order here is such that it's convenient when using a pipe:

beforAnimation
    |> andAfter afterAnimation
alongWith : (Float -> a -> b -> c) -> Animation a -> Animation b -> Animation c

Most general combination of two Animations.

You probably want to narrow this down for your specific domain.

Many animations

together : List (Animation a) -> Animation (List a)

Plays a list of Animations together.

Almost certainly more useful narrowed to a specific domain. Use mapRes to turn List a into something more helpful.

sequence : a -> List (Animation a) -> Animation a

With an initial value, plays a list of Animation in sequence.