varying-0.1.0.0: Automaton based varying values, event streams and tweening.

Safe HaskellNone
LanguageHaskell2010

Control.Varying.Tween

Description

 

Synopsis

Documentation

easeInQuad :: Num t => Easing t Source

Ease in quadratic.

easeOutQuad :: Num t => Easing t Source

Ease out quadratic.

easeInOutQuad :: (Ord t, Fractional t) => Easing t Source

Ease in and out quadratic.

easeInCubic :: Num t => Easing t Source

Ease in cubic.

easeOutCubic :: Num t => Easing t Source

Ease out cubic.

easeInOutCubic :: (Ord t, Fractional t) => Easing t Source

Ease in and out cubic.

easeInPow :: Num t => Int -> Easing t Source

Ease in by some power.

easeOutPow :: Num t => Int -> Easing t Source

Ease out by some power.

easeInSine :: Floating t => Easing t Source

Ease in sinusoidal.

easeOutSine :: Floating t => Easing t Source

Ease out sinusoidal.

easeInOutSine :: Floating t => Easing t Source

Ease in and out sinusoidal.

easeInExpo :: Floating t => Easing t Source

Ease in exponential.

easeOutExpo :: Floating t => Easing t Source

Ease out exponential.

easeInOutExpo :: (Ord t, Floating t) => Easing t Source

Ease in and out exponential.

easeInCirc :: Floating t => Easing t Source

Ease in circular.

easeOutCirc :: Floating t => Easing t Source

Ease out circular.

easeInOutCirc :: (Ord t, Floating t) => Easing t Source

Ease in and out circular.

easeInOut :: (Ord t, Num t, Fractional t) => Easing t -> Easing t -> Easing t Source

Ease in and out using the given easing equations.

linear :: Num t => Easing t Source

Ease linear.

constant :: (Monad m, Num t, Ord t) => a -> t -> Var m t (Event a) Source

Ease none. This performs no interpolation over the duration, it just samples at a constant value until the duration is up.

type Easing t = t -> t -> t -> t Source

An easing function.

type Tween m t = t -> t -> t -> Var m t (Event t) Source

A linear interpolation between two values over some duration.

tween :: (Monad m, Fractional t, Ord t) => Easing t -> t -> t -> t -> Var m t (Event t) Source

Produces an event sample interpolated between a start and end value using an easing equation (Easing) over a duration. The resulting Var will take a time delta as input. For example:

testWhile_ isEvent v
   where v :: Var IO a (Event Double)
         v = deltaUTC ~> tween easeOutExpo 0 100 5

Keep in mind tween must be fed time deltas, not absolute time or duration. This is mentioned because the author has made that mistake more than once ;)

timeAsPercentageOf :: (Monad m, Ord t, Num t, Fractional t) => t -> Var m t t Source

Varies 0.0 to 1.0 linearly for duration t and 1.0 after t.