raphael js hover减慢动画

时间:2013-07-17 18:33:03

标签: raphael

这是我要去的地方

http://jsfiddle.net/lono1981/CvMEX/2/

var paper = Raphael("paper");

var gear1 = paper.image( "https://dl.dropboxusercontent.com/u/55552239/Testing%20Stuff/gear1.png",20,20,171,171,171);

var gear2 = paper.image( "https://dl.dropboxusercontent.com/u/55552239/Testing%20Stuff/gear2.png",175,30,43,43,43);

var gear3 = paper.image( "https://dl.dropboxusercontent.com/u/55552239/Testing%20Stuff/gear3.png",190,70,84,84,84);

var anim1 = Raphael.animation({transform: "r360"}, 4000).repeat(Infinity);
gear1.animate(anim1);

var anim2 = Raphael.animation({transform: "r-360"}, 3500).repeat(Infinity);
gear2.animate(anim2);

var anim3 = Raphael.animation({transform: "r-360"}, 3500).repeat(Infinity);
gear3.animate(anim3);

var f_in = function() {
    gear1.stop();
};

var f_out = function() {
gear1.animate(anim1);
};

gear1.hover (f_in,f_out);

基本上,一旦悬停停止并重新开始动画,动画就会变慢并且不会重复播放。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

修正了它: DEMO

var anim1 = Raphael.animation({transform: "...r360"}, 4000).repeat(Infinity);
gear1.animate(anim1);

每当您想要追加到每次...时都要执行的转换时,您必须在transform()中添加hover

祝你好运!