大家好,我正在尝试使用 Element.animate() 使用 Set 一次旋转几个对象,但它会旋转每个元素而不是整个集合,我需要整个集合
请帮帮我,我对 raphael 很陌生,只有几个小时的阅读文档和尝试功能
var archtype = Raphael("canvas", 600, 600);
archtype.customAttributes.arc = function (xloc, yloc, value, total, R) {
var alpha = 360 / total * value,
a = (90 - alpha) * Math.PI / 180,
x = xloc + R * Math.cos(a),
y = yloc - R * Math.sin(a),
path;
if (total == value) {
path = [["M", xloc, yloc - R],["A", R, R, 0, 1, 1, xloc - 0.01, yloc - R]];
} else {
path = [["M", xloc, yloc - R],["A", R, R, 0, +(alpha > 180), 1, x, y]];
}
return {
path: path
};
};
var circleSet=archtype.set();
var arc_red0 = archtype.path().attr({
"stroke": "#f00",
"stroke-width": 30,
arc: [300, 300, 30, 360, 250]
});
circleSet.push(arc_red0);
var arc_red1 = archtype.path().attr({
"stroke": "#f00",
"stroke-width": 30,
arc: [300, 300, 20, 360, 250],
"transform": "r50,300,300"
});
circleSet.push(arc_red1);
var arc_red2 = archtype.path().attr({
"stroke": "#f00",
"stroke-width": 30,
arc: [300, 300, 80, 360, 250],
"transform": "r90,300,300"
});
circleSet.push(arc_red2);
var arc_red3 = archtype.path().attr({
"stroke": "#f00",
"stroke-width": 30,
arc: [300, 300, 60, 360, 250],
"transform": "r190,300,300"
});
circleSet.push(arc_red3);
var arc_red4 = archtype.path().attr({
"stroke": "#f00",
"stroke-width": 30,
arc: [300, 300, 70, 360, 250],
"transform": "r270,300,300"
});
circleSet.push(arc_red4);
var $angle=0;
(function (){
circleSet.animate({transform:"r"+$angle+",300,300"},200);
$angle++;
init = false;
setTimeout(arguments.callee, 60);
})();