[英]Raphael animation
我是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添加鼠标悬停。 当我添加该代码时,矩形不再旋转。 它只是静止的。 如果有人可以帮助我制作这个动画,我将不胜感激。
谢谢
您的代码中有错误:
<script src=" src="jquery-1.7.2.js"></script>
更改为:
<script src="jquery-1.7.2.js"></script>
那应该可以解决jQuery的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.