repeat()的用法
repeat()动画的重复次数,参数为数字。当参数为Infinity的时候表示无限次。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新建画布</title>
<script type="text/javascript" src="raphael.js"></script>
<!---->
</head>
<body>
<div id="papr">
<script>
var paper = new Raphael("papr", 500, 500);
var circle = paper.circle(350, 350, 100);
circle.attr({
"stroke": "blue",
"fill": "red"
});
var animates = Raphael.animation(
{
"50%": {"r": 50, "fill": "green", "cx": 100, "cy": 100},
"100%": {"r": 100, "fill": "red", "cx": 350, "cy": 350}
},
1000, "bounce").repeat(Infinity);
//repeat()在animation的第一参数即动画的最终样式用百分比表示的时候,才可以起作用。
circle.animate(animates);
</script>
</div>
</body>
</html>