reflex-animation-0.1.5: Continuous animations support for reflex

Safe HaskellNone
LanguageHaskell2010

Reflex.Animation

Synopsis

Documentation

newtype Animation time a Source

Infinite animations time -> a. Supports operations: * Mapping over either time or the value using the Functor/Profunctor(lmap, rmap) * Combined in parallel with other infinite animations using Applicative/Monad * Turned into a finite animation by crop

Constructors

Animation 

Fields

sampleAt :: time -> a
 

stretched :: Num time => time -> Animation time a -> Animation time a Source

delayed :: Num time => time -> Animation time a -> Animation time a Source

data Clip time a Source

Finite animations, Animation with a period. Supports operations: * Combined end-to end using Semigroup instance, e.g. sconcat * Combined with Infinite animations with apply * Turned into Inifinite animations by either: > Clamping time - clamped > Using Maybe - toMaybe > Repeating - repeat * Futher cropped in various ways

Constructors

Clip 

Fields

clipAnim :: Animation time a
 
period :: time
 

Instances

Functor (Clip time) Source 
(Num time, Ord time) => Semigroup (Clip time a) Source 

sampleClip :: (Ord time, Num time) => Clip time a -> time -> Maybe a Source

Sample from a clip, returning Nothing outside the domain

toMaybe :: (Ord time, Num time) => Clip time a -> Animation time (Maybe a) Source

Turn a clip into an infinite Animation by using Maybe

stretchTo :: RealFrac time => time -> Clip time a -> Clip time a Source

Stretch a clip to a specific size by scaling time

apply :: Clip time (a -> b) -> Animation time a -> Clip time b Source

crop :: (Ord time, Num time) => (time, time) -> Animation time a -> Clip time a Source

Take a section of an infinite animation as a Clip

clamped :: (Ord time, Num time) => Clip time a -> Animation time a Source

Make an infinite animation by clamping time to lie within the period

repeat :: RealFrac time => Clip time a -> Animation time a Source

Make an infinite animation by repeating the clip

replicate :: RealFrac time => Int -> Clip time a -> Clip time a Source

Repeat a clip a fixed number of times to make a new one

cropEnd :: (Ord time, Num time) => time -> Clip time a -> Clip time a Source

Shorten a clip to a certain period by cropping the end

cropStart :: (Ord time, Num time) => time -> Clip time a -> Clip time a Source

Shorten a clip by cropping the start

reCrop :: (Ord time, Num time) => (time, time) -> Clip time a -> Clip time a Source

Crop the clip to a range

linear :: (VectorSpace v, RealFrac (Scalar v)) => Interpolater (Scalar v) v Source

linearIn :: RealFrac time => time -> Clip time time Source

Predefined clips based on special functions for building up animations

linearOut :: RealFrac time => time -> Clip time time Source

piecewise :: (Ord time, Num time) => [Clip time a] -> Clip time a Source

Piecewise animation using several clips concatenated end to end, one playing after the other, equivalent to sconcat.

keyframes :: (VectorSpace v, RealFrac (Scalar v)) => v -> [(Scalar v, v)] -> Clip (Scalar v) v Source

Keyframer using linear interpolation Specified as pairs of (value, interval) First key is provided separately and always starts at time = 0

keyframesWith :: RealFrac time => Interpolater time a -> a -> [(time, a)] -> Clip time a Source

Keyframes using an interpolator between intervals (e.g. linear)

half :: RealFrac time => Clip time a -> Clip time a Source

Crop the clip to half the period

sine :: (RealFrac time, Floating time) => time -> Clip time time Source

cosine :: (RealFrac time, Floating time) => time -> Clip time time Source

clamp :: Ord a => (a, a) -> a -> a Source

fmod :: RealFrac a => a -> a -> a Source

Utility functions