--- title: animateMotion slug: Web/SVG/Element/animateMotion tags: - Element - SVG - SVG Animation translation_of: Web/SVG/Element/animateMotion ---
SVG の <animateMotion> 要素は、ある要素がモーションパスに沿って移動する方法を定義します。
注: 既存のパスを再利用するには、 <animateMotion> 要素内の {{SVGElement("mpath")}} 要素を {{SVGAttr("path")}} 属性の代わりに使用する必要があります。
html,body,svg { height:100%; margin: 0; padding: 0; display:block; }
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<path fill="none" stroke="lightgrey"
d="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" />
<circle r="5" fill="red">
<animateMotion dur="10s" repeatCount="indefinite"
path="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" />
</circle>
</svg>
{{EmbedLiveSample('Exemple', 150, '100%')}}
{{svginfo}}
auto|auto-reverse; Default value: 0; Animatable: no注: <animateMotion> においては、 {{SVGAttr("calcMode")}} 属性の既定値は paced です。
この要素は {{domxref("SVGAnimateMotionElement")}} インターフェイスを実装しています。
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName("SVG Animations 2", "#AnimateMotionElement", "<animateMotion>")}} | {{Spec2("SVG Animations 2")}} | 変更なし |
| {{SpecName('SVG1.1', 'animate.html#AnimateMotionElement', '<animateMotion>')}} | {{Spec2('SVG1.1')}} | 初回定義 |
{{Compat("svg.elements.animateMotion")}}