Javascript 如何在动画帧上使用减速算法?

Javascript 如何在动画帧上使用减速算法?,javascript,animation,physics,bezier,requestanimationframe,Javascript,Animation,Physics,Bezier,Requestanimationframe,我想在一个动画上使用减速,我正在通过请求动画帧运行!我知道如何实现速度,对于减速,我找到了这个项目https://github.com/gre/bezier-easing。我现在是TIAS,但不知道该怎么做https://github.com/gre/bezier-easing。我希望最后速度会下降velocity我找到了解决方案,为我工作: // http://cubic-bezier.com/#0.25,0.25,0,1 var easing = BezierEasing(0.25, 0.2

我想在一个动画上使用减速,我正在通过请求动画帧运行!我知道如何实现速度,对于减速,我找到了这个项目
https://github.com/gre/bezier-easing
。我现在是TIAS,但不知道该怎么做
https://github.com/gre/bezier-easing
。我希望最后速度会下降
velocity我找到了解决方案,为我工作:

// http://cubic-bezier.com/#0.25,0.25,0,1
var easing = BezierEasing(0.25, 0.25, 0, 0.9),
            i = 0,
            stepIncrementAmount = 0.25;

(function loop() {

    // sorry about the * 100 but that's what $knob expects, scale range 0 > 100, and easing needs 0 to 1
    velocity = easing(i / 100) * 100;

    if (velocity <= parseFloat(attrs.radialBarPercentage)) {
        $knob.val(velocity).trigger('change');
        i += stepIncrementAmount;
        animationFrame.request(loop);
    }

})();
//http://cubic-bezier.com/#0.25,0.25,0,1
var宽松=贝塞尔宽松(0.25,0.25,0,0.9),
i=0,
逐步递增金额=0.25;
(函数循环(){
//抱歉*100,但这正是$knob所期望的,标度范围0>100,缓和需要0到1
速度=缓解(i/100)*100;
if(速度
// http://cubic-bezier.com/#0.25,0.25,0,1
var easing = BezierEasing(0.25, 0.25, 0, 0.9),
            i = 0,
            stepIncrementAmount = 0.25;

(function loop() {

    // sorry about the * 100 but that's what $knob expects, scale range 0 > 100, and easing needs 0 to 1
    velocity = easing(i / 100) * 100;

    if (velocity <= parseFloat(attrs.radialBarPercentage)) {
        $knob.val(velocity).trigger('change');
        i += stepIncrementAmount;
        animationFrame.request(loop);
    }

})();