开发者

How to draw curves with raphael js?

I want draw a Shape like M114,100c0,50 100-50 100,0c0,50 -100-50 -100 during 5 seconds, How to do that with raphael js?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Raphaël · Gear</title>
<style type="text/css">
body{overflow-x:hidden;overflow-y:scroll;width:100%;padding:0;margin:0;background-color:#022d00;}
</style>
<script src="raphael-min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
window.onload = function () {
    var paper = Raphael(0, 0, 500, 600);
    var path1=paper.path("M114 253").attr({"stroke": "#999", "stroke-width":1});

    path1.animate({path: "M114,100开发者_如何学Cc0,50 100-50 100,0c0,50 -100-50 -100"},5000).attr({"stroke": "#999", "stroke-width":1});
});
}
</script>
</head>
<body>
    <div id="stroke"></div>
</body>
</html>


Take out one 'lot' of attr for path1

var path1=paper.path("M114 253")

path1.animate({path: "M114,100c0,50 100-50 100,0c0,50 -100-50 -100"},5000).attr({"stroke": "#999", "stroke-width":1}); 

or

var path1=paper.path("M114 253").attr({"stroke": "#999", "stroke-width":1});      

path1.animate({path: "M114,100c0,50 100-50 100,0c0,50 -100-50 -100"},5000);

works for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜