Javascript 拉斐尔动画
我是拉斐尔的新手,正在尝试做一些非常简单的事情,但失败得很惨 我正在尝试复制动画,这是我到目前为止的代码:Javascript 拉斐尔动画,javascript,animation,raphael,Javascript,Animation,Raphael,我是拉斐尔的新手,正在尝试做一些非常简单的事情,但失败得很惨 我正在尝试复制动画,这是我到目前为止的代码: <html> <head><title></title> <script src="raphael-min.js"></script> <script src=" src="jquery-1.7.2.js"></script> </head> <body> <d
<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>
您的代码中有一个错误:
<script src=" src="jquery-1.7.2.js"></script>
您的代码中有一个错误:
<script src=" src="jquery-1.7.2.js"></script>
你看到这里有什么问题吗:你看到这里有什么问题吗:啊,是的。非常感谢。现在动画正在工作,但它不会出现在页面的右下角。它会向左或向下移动,然后消失。有什么想法吗?啊,有。非常感谢。现在动画正在工作,但它不会出现在页面的右下角。它会向左或向下移动,然后消失。有什么想法吗?