2017-05-01 68 views
0

下面是一個使用SVG.js形狀擴展在星形創建的示例。當我要求從7點(尖峯)到10點(尖峯)進行動畫處理時,會產生錯誤。SVG.js:形狀擴展:動畫錯誤

任何想法?

<!DOCTYPE html> 
 
<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
 
    <title>SVG.js - Shapes Extension: animate error</title> 
 
    <script type="text/javascript" src="//svgDiscovery.com/SVG.js/svg.js"></script> 
 
    <script type="text/javascript" src="//svgDiscovery.com/SVG.js/Plugins/svg.shapes.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 - Shapes Extension: animate error</h4> 
 
<table> 
 
<tr> 
 
<td> 
 
<div id="svgDiv" style='background-color:lightgreen;width:400px;height:400px;'></div> 
 
</td> 
 
</tr></table> 
 
<script id=myScript> 
 
//---access the empty DIV--- 
 
var mySVG = SVG('svgDiv').size(400, 400); 
 

 
var myStar = mySVG.polygon().attr({id:'myPolygon',stroke:'blue','stroke-width':3,fill:'yellow'}).star({ 
 
    inner: 50 
 
, outer: 100 
 
, spikes: 7 
 
}).move(100,100) 
 

 
//---creates error--- 
 
myStar.animate().star({ spikes: 10 }) 
 
</script> 
 
</body> 
 
</html>

+0

形狀插件不支持動畫作品完全相同。這是一個有趣的主意:) – Fuzzyma

+0

@Fuzzyma實際上,此擴展名顯示了動畫支持。請參閱:https://github.com/svgdotjs/svg.shapes.js –

+0

好的。我必須更仔細地研究這個,然後 – Fuzzyma

回答

1

於是我找到更新此擴展的時間。只要包裝衝突在npm上解決,它也可以在涼亭上使用。

現在需要svg.js的2版本,並根據您指定

mySVG 
    .polygon() 
    .ngon() 
    .animate() 
    .star() 
+0

是的,我更新了擴展文件,它的工作原理只是丹迪。謝謝! –