1. 開発者向けのウェブ技術
  2. SVG
  3. リファレンス
  4. 要素
  5. <mpath>

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

<mpath>

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2018年10月⁩.

* Some parts of this feature may have varying levels of support.

<mpath>SVG における <animateMotion> 要素のサブ要素で、モーションパスの定義として外部の <path> 要素を参照する機能を提供します。

使用コンテキスト

カテゴリーアニメーション要素
許可されている内容任意の数、任意の順序の以下の要素。
説明的要素

属性

DOM インターフェイス

この要素は SVGMPathElement インターフェイスを実装しています。

SVG

html
<svg
 width="100%"
 height="100%"
 viewBox="0 0 500 300"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink">
 <rect
 x="1"
 y="1"
 width="498"
 height="298"
 fill="none"
 stroke="blue"
 stroke-width="2" />
 <!-- Draw the outline of the motion path in blue, along
 with three small circles at the start, middle and end. -->
 <path
 id="path1"
 d="M100,250 C 100,50 400,50 400,250"
 fill="none"
 stroke="blue"
 stroke-width="7.06" />
 <circle cx="100" cy="250" r="17.64" fill="blue" />
 <circle cx="250" cy="100" r="17.64" fill="blue" />
 <circle cx="400" cy="250" r="17.64" fill="blue" />
 <!-- Here is a triangle which will be moved about the motion path.
 It is defined with an upright orientation with the base of
 the triangle centered horizontally just above the origin. -->
 <path
 d="M-25,-12.5 L25,-12.5 L 0,-87.5 z"
 fill="yellow"
 stroke="red"
 stroke-width="7.06">
 <!-- Define the motion path animation -->
 <animateMotion dur="6s" repeatCount="indefinite" rotate="auto">
 <mpath href="#path1" />
 </animateMotion>
 </path>
</svg>

結果

仕様書

Specification
SVG Animations Level 2
# MPathElement

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /