Copyright | (c) Hans Hoglund 2012-2014 |
---|---|
License | BSD-style |
Maintainer | hans@hanshoglund.se |
Stability | experimental |
Portability | non-portable (TF,GNTD) |
Safe Haskell | None |
Language | Haskell2010 |
- data Behavior a
- behavior :: Iso (Time -> a) (Time -> b) (Behavior a) (Behavior b)
- switch :: Time -> Behavior a -> Behavior a -> Behavior a
- switch' :: Time -> Behavior a -> Behavior a -> Behavior a -> Behavior a
- trimBefore :: Monoid a => Time -> Behavior a -> Behavior a
- trimAfter :: Monoid a => Time -> Behavior a -> Behavior a
- line :: Fractional a => Behavior a
- sawtooth :: RealFrac a => Behavior a
- sine :: Floating a => Behavior a
- cosine :: Floating a => Behavior a
- unit :: Fractional a => Behavior a
- impulse :: Num a => Behavior a
- turnOn :: Behavior Integer
- turnOff :: Behavior Integer
Behavior type
A Behavior
is a value varying over time.
Examples
behavior :: Iso (Time -> a) (Time -> b) (Behavior a) (Behavior b) Source
View a behavior as a time function and vice versa.
Note that this is just an alias defined to make the documentation nicer:
behavior
=tabulated
Combinators
switch :: Time -> Behavior a -> Behavior a -> Behavior a Source
Instantly switch from one behavior to another.
switch' :: Time -> Behavior a -> Behavior a -> Behavior a -> Behavior a Source
Instantly switch from one behavior to another with an optinal intermediate value.
trimBefore :: Monoid a => Time -> Behavior a -> Behavior a Source
Replace everthing before the given time by mempty
.
trimAfter :: Monoid a => Time -> Behavior a -> Behavior a Source
Replace everthing after the given time by mempty
.
Common behaviors
Oscillators
line :: Fractional a => Behavior a Source
sawtooth :: RealFrac a => Behavior a Source
A behavior that goes from 0 to 1 repeatedly with a period of 1.
Impulse functions
unit :: Fractional a => Behavior a Source
A behavior that varies from 0 to 1 during the same time interval and is 0 before and 1 after that interval.