有什么方法可以切换您在 RaphaelJS 中所做的转换?截至目前,以下代码可在单击时使圆圈变大。我需要的是切换转换,以便我可以再次单击,然后圆圈缩小并移回原位。
window.onload = function() {
centerX = 300;
centerY = 300;
var paper = new Raphael(document.getElementById('canvas_container'), 900, 900);
//setup main circle
var mainCircle = paper.circle(centerX,centerY,90);
mainCircle.attr(
{
gradient: '90-#526c7a-#64a0c1',
stroke: '#3b4449',
'stroke-width': 10,
'stroke-linejoin': 'round',
rotation: -90
}
);
//when clicking main circle
mainCircle.click( function(e) {
//move and grow the main circle
mainCircle.animate({cx:00, cy:00, r:100}, 1000, "easeout");
mainCircle.animate({
"transform": "s " + (s = 3)}, 1000, "easeout"
});
});