This library supplies you with observable for tweening over numbers.
npm i xes-rx-tween
import { tweenObservable } from 'xes-rx-tween';
tweenObservable(2000, 0, 100)
.subscribe((interpolationValue) => {
// do some stuff with interpolationValue for example
object.x = interpolationValue;
})
You also can do some more stuff with tweened value for example use some tweening functions on them:
import { tweenObservable } from 'xes-rx-tween';
const easingFunction = (x) => Math.sin(x * Math.PI);
tweenObservable(2000, 1, 1.5)
.map(easingFunction)
.subscribe((interpolationValue) => {
// do some stuff with interpolationValue for example
object.scale = interpolationValue;
})
Single run
npm run test
Watch mode
npm run test:watch