1.1.0 • Published 4 years ago

@rbxts/easing-functions v1.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

EasingFunctions

A bunch of reuseable Easing Functions, including those from the Material Design specification (Standard, Acceleration, and Deceleration)

These are the available EasingFunctions:

DirectionlessInOutInOutOutIn
LinearInQuadOutQuadInOutQuadOutInQuad
SpringInCubicOutCubicInOutCubicOutInCubic
SoftSpringInQuartOutQuartInOutQuartOutInQuart
RevBackInQuintOutQuintInOutQuintOutInQuint
RidiculousWiggleInSineOutSineInOutSineOutInSine
SmoothInExpoOutExpoInOutExpoOutInExpo
SmootherInCircOutCircInOutCircOutInCirc
AccelerationInElasticOutElasticInOutElasticOutInElastic
DecelerationInBackOutBackInOutBackOutInBack
SharpInBounceOutBounceInOutBounceOutInBounce
Standard

Signature:

/**
 * Returns a value between [initialValue, initialValue + changeInValue] or [0, 1] that represents an in-between value
 * along a Bezier curve.
 * @param elapsedTime the time elapsed [0, d]
 * @param initialValue beginning value being interpolated (default = 0)
 * @param changeInValue change in value being interpolated (equivalent to: ending - beginning) (default = 1)
 * @param totalDuration duration interpolation is occurring over (default = 1)
 */
type BasicEasingFunction = (
	elapsedTime: number,
	initialValue: number,
	changeInValue: number,
	totalDuration: number,
) => number;

Some functions have an extra parameter or two. These will either be the amplitude and period or the overshoot.