XML/SVG/animate — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
| |
Текущая версия на 08:25, 26 мая 2010
Содержание
Chained Animation Effects
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(50,50)">
<rect width="500" height="400" fill="none" stroke-width="4"
stroke="black" />
</g>
<g transform="translate(50,50)">
<rect id="rect1" x="0" y="0" width="100" height="100"
stroke-width="4" stroke="blue" fill="red">
<animate id="rect1b" attributeName="x" attributeType="XML"
begin="0s" dur="2s" fill="freeze" from="0" to="400" />
</rect>
<rect id="rect2" x="400" y="0" width="100" height="100"
stroke-width="4" stroke="blue" fill="green">
<animate id="rect2b" attributeName="y" attributeType="XML"
begin="rect1b.end" dur="4s" fill="freeze" from="0" to="200" />
</rect>
</g>
</svg>
Continuous Rotation of a Text String
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width="100%" height="100%">
<g transform="translate(0,0)">
<text id="background" x="200" y="200" fill="red"
fill-opacity="1" font-size="24">
Rotating text
</text>
<animateTransform begin="0s" dur="4s" type="rotate"
from="0 200 200" to="360 200 200" fill="freeze"
attributeName="transform" />
</g>
</svg>
Multiple Animation Effects
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%"
xmlns="http://www.w3.org/2000/svg">
<g transform="translate(100,100)">
<text x="0" y="0" font-size="48" visibility="hidden"
stroke="black" stroke-width="2">
Animating Text
<set attributeName="visibility"
attributeType="CSS" to="visible"
begin="2s" dur="5s" fill="freeze"/>
<animateMotion path="M0,0 L50,150"
begin="2s" dur="5s" fill="freeze"/>
<animateColor attributeName="fill"
attributeType="CSS"
from="yellow" to="red"
begin="2s" dur="8s" fill="freeze"/>
<animateTransform attributeName="transform"
attributeType="XML"
type="rotate" from="-90" to="0"
begin="2s" dur="5s" fill="freeze"/>
</text>
</g>
</svg>
Rectangles and Multiple Animation Effects
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%"
xmlns="http://www.w3.org/2000/svg">
<rect fill="red" stroke-width="1" stroke="blue"
x="300" y="100" width="300" height="100">
<animate attributeName="stroke" attributeType="XML"
begin="1s" dur="5s"
fill="freeze" from="blue" to="yellow"/>
<animate attributeName="stroke-width"
attributeType="XML"
begin="1s" dur="5s"
fill="freeze" from="1" to="40"/>
<animate attributeName="x" attributeType="XML"
begin="1s" dur="5s"
fill="freeze" from="300" to="100"/>
<animate attributeName="y" attributeType="XML"
begin="2s" dur="5s"
fill="freeze" from="100" to="50"/>
<animate attributeName="width" attributeType="XML"
begin="3s" dur="5s"
fill="freeze" from="300" to="500"/>
<animate attributeName="height" attributeType="XML"
begin="4s" dur="5s"
fill="freeze" from="100" to="300"/>
</rect>
</svg>