下面是一个尝试使用SVG.js为rect设置宽度和高度动画的示例;宽度和宽度height都列为可动画的有效方法。动画没有回复。
它返回错误:" myRect.animate(...)。width不是函数"
有什么想法吗?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SVG.js - Rect Animate Width/Height</title>
<script type="text/javascript" src="//svgDiscovery.com/SVG.js/svg.js"></script>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body style='padding:10px;font-family:arial;'>
<center>
<h4>SVG.js - Rect Animate Width/Height</h4>
<table>
<tr>
<td>
<div id="svgDiv" style='background-color:lightgreen;width:400px;height:400px;'></div>
</td>
</tr></table>
<script>
var mySVG = SVG('svgDiv').size(400, 400);
var myRect = mySVG.rect(100,100).attr({x:150,y:150,id:'myRect',fill: '#f00','stroke-width':3,stroke:'black'});
myRect.animate().width(300)
myRect.animate().height(300)
</script>
</body>
</html>
&#13;
答案 0 :(得分:1)
您的问题已在2.6.2版中修复。宽度和高度现在可以按预期使用