Tecnologías XML / SVG / Utilizar animaciones / Formas de realizar animaciones / animateMotion mueve un elemento por un trazado

(Extracto de «Das Einsteigerseminar SVG — Webgrafiken mit XML» de Helma Spona)

La etiqueta <animateMotion> mueve un elemento por un trazado definido. Tiene estos atributos:

Nota:
keyPoints, en la etiqueta <animateMotion>, debe contener pares de coordenadas x/y. Las listas tienen la forma x1,y1;x2,y2;...;xn,yn: el punto y coma separa pares y las comas sus valores. Los atributos from, to y by también deben contener pares.

<defs>
  <animateMotion xlink:href="#Quadr1" dur="3s" path="M0 0 l+200 +200" fill="freeze" calcMode="discrete"/>
  <animateMotion xlink:href="#Quadr2" dur="6s" path="M0 0 l+200 +200" rotate="45"/>
  <animateMotion xlink:href="#Quadr3" dur="3s" path="M0 0 l+200 +200" repeatCount="10" repeatDur="12s"/>
</defs>
<g>
  <path id="Pfad" d="M0 0 l+200 +200" style="stroke:black;stroke-opacity:0.5;fill:none"/>
  <rect id="Quadr1" x="0" y="0" width="10" height="10" style="fill:red;stroke:black;"/>
</g>
<g transform="translate(0 50)">
  <path id="Pfad" d="M0 0 l+200 +200" style="stroke:black;stroke-opacity:0.5;fill:none"/>
  <rect id="Quadr2" x="0" y="0" width="10" height="10" style="fill:red;stroke:black;"/>
</g>
<g transform="translate(0 100)">
  <path id="Pfad" d="M0 0 l+200 +200" style="stroke:black;stroke-opacity:0.5;fill:none"/>
  <rect id="Quadr3" x="0" y="0" width="10" height="10" style="fill:red;stroke:black;"/>
</g>

Animaciones en ejecución

Figura: animaciones en ejecución.

Nota:
Las imágenes fijas representan mal las animaciones: pruébela usted mismo.

   

<< atrás

siguiente >>

 

 

 

volver arriba