Sample easing functions from MDN
A drop-in replacement for tween-functions.
These are Robert Penner's tweening functions. The same as those used in react-tween-state and react-state-stream.
Note: Penner's original functions used the incremental change in time rather than the absolute cumulative time difference between the start time and the current time. For greater precision, these functions use the latter.
import { easeOutQuad } from 'tween-functions-ts';
const currentValue = easeOutQuad(elapsedTime, fromValue, toValue, duration);Direct imports are also supported, for maximum performance:
import { easeOutQuad } from 'tween-functions-ts/dist/easeOutQuad';lineareaseInBackeaseInBounceeaseInCirceaseInCubiceaseInElasticeaseInExpoeaseInOutBackeaseInOutBounceeaseInOutCirceaseInOutCubiceaseInOutElasticeaseInOutExpoeaseInOutQuadeaseInOutQuarteaseInOutQuinteaseInOutSineeaseInQuadeaseInQuarteaseInQuinteaseInSineeaseOutBackeaseOutBounceeaseOutCirceaseOutCubiceaseOutElasticeaseOutExpoeaseOutQuadeaseOutQuarteaseOutQuinteaseOutSine
- This library is a clone of chenglou/tween-functions, with these differences:
- written in typescript
- adds JSDoc
- modern packaging
- @environment-safe/tween is roughly the same, but has a dependency.
- d3-ease only deals with values of the range 0..1, so you must do additional calculations.