Finally got the chance to organize something after 8 months. There are projects through projects I’ve been involved. Sometimes need to work overtime a bit, sometimes dedicate myself into learning. I dived into learning SVG animation recently. This article is just for myself as a learning note. And hope it can help someone who’s learning as well.
Speaking about SVG animation, we’ll directly think to SMIL
. The whole word is Synchronized Multimedia Integration Language
.
There’s five main attributes we can use in SMIL
.
SVG Animation
・
・
・
・
1
<animateTransform attributeName="transform" begin="0s" dur="3s" type="scale" from="1" to="1.5" repeatCount="indefinite”/>
・
1
2
3
4
5
6
<svg width="360" height="200" xmlns="http://www.w3.org/2000/svg”>
<text font-family="microsoft yahei" font-size="40" x="0" y="0" fill="#cd0000”>马
<animateMotion path="M10,80 q100,120 120,20 q140,-50 160,0" begin="0s" dur="3s" repeatCount="indefinite”/>
</text>
<path d="M10,80 q100,120 120,20 q140,-50 160,0" stroke="#cd0000" stroke-width="2" fill="none" />
</svg>
以上我比較常使用到的是animate,使用«animate»時在begin的attribute放入click,可以在不用到js的情況下操縱頁面的點擊事件,能夠利用«g»或是
其餘有趣的內容會找時間再整理codepen分享。