關鍵點
keyPoints 屬性指示動畫的簡單持續時間。
你可以將此屬性與以下 SVG 元素一起使用
示例
html
<svg
viewBox="0 0 120 120"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<path
d="M10,110 A120,120 -45 0,1 110 10 A120,120 -45 0,1 10,110"
stroke="lightgrey"
stroke-width="2"
fill="none"
id="motionPath" />
<circle cx="10" cy="110" r="3" fill="lightgrey" />
<circle cx="110" cy="10" r="3" fill="lightgrey" />
<circle r="5" fill="red">
<animateMotion
dur="3s"
repeatCount="indefinite"
keyPoints="0;0.5;1"
keyTimes="0;0.15;1"
calcMode="linear">
<mpath href="#motionPath" />
</animateMotion>
</circle>
</svg>
用法說明
<number> [; <number>] ;?-
此值定義了一個由浮點值組成的、以分號分隔的列表,這些值介於 0 和 1 之間,並指示物件在由相應
keyTimes值指定的時間點上沿著運動路徑移動的距離。距離是沿著由path屬性指定的路徑計算的。列表中的每個進度值對應於keyTimes屬性列表中的一個值。如果指定了關鍵點列表,則
keyPoints列表中的值數量必須與keyTimes列表中的值數量完全相同。如果值末尾有分號,後面可選地跟著空格,則分號和尾隨的空格都會被忽略。
如果值規範中存在任何錯誤(例如,無效值,值過多或過少),則這是一個錯誤。
規範
| 規範 |
|---|
| SVG 動畫級別 2 # KeyPointsAttribute |
瀏覽器相容性
載入中…