admin管理员组文章数量:1419227
So I'm using Raphael JS to try and animate.
Here's what I've tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ".dtd">
<html>
<head>
<script type="text/javascript" src=".4.2/jquery.min.js"></script>
<script type="text/javascript" src=".js"></script>
<script type="text/javascript">
$(window).load(function () {
var R = Raphael("holder", 640, 480);
var test = R.text(200, 200, "Test string");
test.animate({cx: 20, cy: 20}, 2000);
});
</script>
</head>
<body>
<div id="holder">
</div>
</body>
</html>
And my text just remains at 200,200. Any thoughts on why this won't work?
So I'm using Raphael JS to try and animate.
Here's what I've tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://raphaeljs./raphael.js"></script>
<script type="text/javascript">
$(window).load(function () {
var R = Raphael("holder", 640, 480);
var test = R.text(200, 200, "Test string");
test.animate({cx: 20, cy: 20}, 2000);
});
</script>
</head>
<body>
<div id="holder">
</div>
</body>
</html>
And my text just remains at 200,200. Any thoughts on why this won't work?
Share Improve this question edited Sep 3, 2010 at 15:52 Incognito asked Sep 3, 2010 at 15:42 IncognitoIncognito 20.8k15 gold badges82 silver badges121 bronze badges1 Answer
Reset to default 5The animate function is only capable of certain attributes, and only able to animate attributes that belong to that particular object.
A text object does not have cx or cy attributes - so your example code will not animate.
You may only translate a text object as it only has x, y and text attributes.
http://raphaeljs./reference.html#text
If you are trying to translate the text, use the x and y attributes like this:
test.animate({x:20, y:20}, 2000);
本文标签: javascriptRaphael JSanimate text()Stack Overflow
版权声明:本文标题:javascript - Raphael JS -- animate .text() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745302241a2652438.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论