|(require ease)||package: jack-ease|
This library includes functions and forms for easing values from one state into another gradually.
source code: https://github.com/jackfirth/racket-ease
Returns a list of intermediate values between start and stop. The number of values is equal to num-steps plus one, and the difference between successive values is determined by easing.Contracts for easings. An easing is a function mapping real numbers between one and zero to any real number. ease/c is equivalent to the following contract:Easing functions map proportions of the ease finished to proportions of the distance travelled between start and stop. An easing function that returns exactly what was given to it is equivalent to easing linearly, the value of the halfway step returned by ease-real will be halfway between the start and stop values given to ease-real. If the easing function returns numbers smaller than that given to it, then ease-real’s steps will be proportionally smaller.Examples:An easing function that returns a number less than zero will cause ease-real to return values less than its starting point during the easing, an easing function that returns a number greater than one will cause ease-real to return values greater than its stopping point. This is useful for "elastic" effects, for example an easing that moves an object just past a stopping position then bounces it back, but most easing functions will satisfy this contract:
An ease satisfying this more restrictive contract is a proper-ease/c.The simplest easing. Makes no changes at all to the relationship between step proportion and distance proportion. Equivalent to identity with a more restrictive contract.
(ease-real/lens a-lens easing target stop num-steps) → list? a-lens : (lens/c any/c real?) easing : ease/c target : any/c stop : real? num-steps : exact-positive-integer?Similar to ease-real, but instead of returning a list of intermediate values, accepts a lens that specifies a view and a target, and returns a list of intermediate targets each with their view eased.
Returns an easing that is like easing, but with proportional changes inverted from easing. If easing starts out proportionally further along than linear-ease, then the returned easing will start out proportionally behind linear-ease.Examples:Returns an easing that is like easing, but with its steps reversed.
Returns an easing function that starts out proportionally slow, then speeds up. The slope of this acceleration is determined by degree. When graphed, the resulting easing is a polynomial curve of the given degree.Examples:Like polynomial-ease, but the returned easing is symmetric. It starts out slow, speeds up towards the middle, then slows down as it approaches the end.Examples:
> (map exact->inexact (ease-real (symmetric-polynomial-ease 1) 0 1000 4))
'(0.0 250.0 500.0 750.0 1000.0)
> (map exact->inexact (ease-real (symmetric-polynomial-ease 2) 0 1000 4))
'(0.0 100.0 500.0 900.0 1000.0)
> (map exact->inexact (ease-real (symmetric-polynomial-ease 5) 0 1000 4))
'(0.0 4.098360655737705 500.0 995.9016393442623 1000.0)