Easing
- Package
- purescript-easings
- Repository
- i-am-tom/purescript-easings
#Easing Source
type Easing = Number -> Number -> Number -> NumberThe Easing type is just to make the code a bit easier to read.
We can call the three inputs, "start", "end", and "progress",
respectively. The "progress" is a number (usually) between 0 and
1, indicating how far through the animation we are (0 being the
start, and 1 being the end). The "start" and "end" values are the
actual values between which we're easing. The result is simply
what the value would be at that point in the progress!
#out Source
out :: Easing -> EasingAll the easings "ease in". For example, the elastic easing will
be elastic around the end of the animation, rather than the
beginning. Sometimes, however, you want the opposite. Well, as
luck would have it, we have the function for you! Simply, this
flips the inputs and progress for an easing function, so you can
use out circular just as you'd use circular.
#polynomial Source
polynomial :: Number -> EasingPolynomial easing. polynomial 1 is your run-of-the-mill linear
easing, start-to-end moving at a constant speed, yawn. However,
the 1 can be replaced with other numbers, and that value will be
the power to which progress is lifted. As it goes up, entry and
exit will become steeper. Somewhere between 1 and 5 is usually
pretty good.
#exponential Source
exponential :: EasingExponential easing. This is an easing whose speed follows the exponential curve: it starts very slow, and ends very fast.
#bounce Source
bounce :: EasingImagine your "end" value is a solid wall. This basically looks
like elastic, except it "bounces" off the end value instead of
going over it. Imagine dropping an h1 from 200px high onto a
tarmac floor (remembering that h1s are quite rubbery). That's
what you get with bounce -200.0 0. This isn't the prettiest of
implementations, so maybe just don't look at it for too long.
- Modules
- Easing