我是 Raphael 的新手,正在尝试做一些非常简单的事情,但失败得很惨。
我正在尝试在此链接上复制动画这是我到目前为止的代码:
<html>
<head><title></title>
<script src="raphael-min.js"></script>
<script src=" src="jquery-1.7.2.js"></script>
</head>
<body>
<div id="draw-here-raphael" style="height: 200px; width: 400px; background: #666;">
</div>
<script type="text/javascript">
//all your javascript goes here
var r = new Raphael("draw-here-raphael", 400, 200),
// Store where the box is
position = 'left',
// Make our pink rectangle
rect = r.rect(20, 20, 50, 50).attr({"fill": "#fbb"});
// Note JQuery is adding the mouseover. SVG == html nodes
$(rect.node).mouseover(function () {
if (position === 'left') {
rect.animate({x: 300, y: 100}, 400, "<>");
position = 'right';
} else {
rect.animate({x: 20, y: 20 }, 800, "bounce");
position = 'left';
}
});
// Make that sucker rotate
setInterval(function () {
rect.rotate(1);
}, 10);
</script>
</body>
</html>
我已经下载了 jquery 并将它放在与 Raphael 相同的文件夹中。不起作用的代码是讨论 jquery 添加鼠标悬停的注释代码。当我添加该代码时,矩形不再旋转。它只是静止的。如果有人可以帮助我制作这个动画,我将不胜感激。
谢谢