http://blog.csdn.net/net_lover/archive/2002/01/25/6889.aspx
下面再看一个沿指定路径运动的例子:
xml 代码
- xml version="1.0" encoding="UTF-8" standalone="no"?>
- "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
- <svg width="500" height="300" viewBox="0 0 500 300"
- xmlns="http://www.w3.org/2000/svg">
- <desc>沿路径运动的例子desc>
- <defs>
- <linearGradient id="grad1" x1="0" y1="0" x2="0" y2="100%" gradientUnits="userSpace">
- <stop offset="0%" style="stop-color: #88f;"/>
- <stop offset="100%" style="stop-color: #008;"/>
- linearGradient>
- defs>
- <rect x="1" y="1" width="498" height="298"
- fill="none" stroke="blue" stroke-width="2" />
- <path d="M100,250 C 100,50 400,50 400,250"
- fill="none" stroke="blue" stroke-width="8" />
- <circle r="25" style="fill:url(#grad1)">
- <animateMotion dur="6s" repeatCount="indefinite"
- path="M100,250 C 100,50 400,50 400,250" rotate="auto" />
- circle>
- <text x="145" y="285" style="font-size:12pt">http://lucky.myrice.comtext>
- svg>
上面的例子应用了animateMotion动画元素,其属性设定和前面类似。