// See RafTimer for how this works. Basically, here we are running raf for // 300ms and the progress is a value between 0-1 which we used to passed to the // interperolators. newRafTimer((progress)=> { // Update the positions of ball. ball.x = ballXInter.calculate(this.progress); ball.y = ballYInter.calculate(this.progress); }).start(300);
Seemoreexamplesinthe /examplesfolder
Unit and Color support.
Interpolate also uses [[cssUnit]] to interprete string values (as best as it
can). You can pass basic css unit values such as '10px' or '10vw' as
from and to values. Color values of rgba and hex are also supported.
It does NOT support cross unit interporalation at the moment such as
from: '0px', to: '10vw'. (Here the units don't match.)
A class that interperolate between values. Interperolate is really a compositoin around mathf.ease.
This can be useful to create low level tweens. Here for example, we can manually, tween the x and y positions of a ball with separate easing.
Unit and Color support.
Interpolate also uses [[cssUnit]] to interprete string values (as best as it can). You can pass basic css unit values such as '10px' or '10vw' as from and to values. Color values of rgba and hex are also supported.
It does NOT support cross unit interporalation at the moment such as from: '0px', to: '10vw'. (Here the units don't match.)
Tested