首页 文章

在Raphael.js中使用立方贝塞尔动画旋转轮

提问于
浏览
1

我是've constructed a 1663661 using Raphael.js and now wish to animate this wheel to some arbitrary degree of rotation. I perform this animation using Raphael.js' s animate function

degrees += 360;
var duration = 1000;

wheel.animate({transform:"r"+degrees+" 250 250"},duration,"cubic-bezier(0,0,1,1)",null);

在这个片段中,我指定了一个恒定的持续时间和一个线性立方贝塞尔曲线,它与轮子的真实旋转完全不同 . 如果旋转有一些变化,我怎样才能最好地对这个变化进行动画处理,以便模拟正在旋转的车轮的物理特性,然后摩擦使车轮在最终旋转度停止?

1 回答

  • 0

    如果您要求将不同的常量传递给 cubic-bezier 函数,我建议您查看cubic-bezier.com,它可以让您使用不同的曲线组合 . 该网站本身仅将该功能应用于线性移动(不是旋转),但它应该为您提供一个很好的起点来修补一些不同的值 .

相关问题