1.1.4 • Published 1 year ago
tween-functions-ts v1.1.4
tween-functions-ts
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.
Usage
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';Functions available
lineareaseInBackeaseInBounceeaseInCirceaseInCubiceaseInElasticeaseInExpoeaseInOutBackeaseInOutBounceeaseInOutCirceaseInOutCubiceaseInOutElasticeaseInOutExpoeaseInOutQuadeaseInOutQuarteaseInOutQuinteaseInOutSineeaseInQuadeaseInQuarteaseInQuinteaseInSineeaseOutBackeaseOutBounceeaseOutCirceaseOutCubiceaseOutElasticeaseOutExpoeaseOutQuadeaseOutQuarteaseOutQuinteaseOutSine
Comparison to other libraries
- 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.