1# animateMotion
2
3
4>  **说明:**
5> 该组件从API version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
6
7路径动效。
8
9## 权限列表
10
1112
13
14## 子组件
15
16不支持。
17
18
19## 属性
20
21支持animate属性(values不生效)和以下表格中的属性。
22
23| 名称 | 类型 | 默认值 | 必填 | 描述 |
24| -------- | -------- | -------- | -------- | -------- |
25| keyPoints | string | - | 是 | 一组关键帧的点位置,每帧的值为对象沿路径的距离比例。功能与animate属性中的values相同。 |
26| path | string | - | 是 | 定义运动的路径,使用与path组件d属性相同的语法。 |
27| rotate | [auto \| auto-reverse \| <number>] | auto | 否 | 设置动画对象的旋转方向。 |
28
29
30## 示例
31
32```html
33<!-- xxx.hml -->
34<div class="container">
35  <svg fill="white" width="400" height="400">
36    <path fill="none" stroke="blue" stroke-width="3" d="m40,60 c0,-100 160,100 160,0 c0,-100 -160,100 -160,0 z"></path>
37    <path fill="none" stroke="blue" stroke-width="3" d="m40,130 c0,-100 160,100 160,0 c0,-100 -160,100 -160,0 z"></path>
38    <path fill="none" stroke="blue" stroke-width="3" d="m40,200 c0,-100 160,100 160,0 c0,-100 -160,100 -160,0 z"></path>
39    <path fill="red" d="M-5,-5 L10,0 L-5,5 L0,0 Z">
40      <animateMotion dur="2000" repeatCount="indefinite" rotate="auto" keyPoints="0;0.2;0.4;0.6;0.8;1" path="m40,60 c0,-100 160,100 160,0 c0,-100 -160,100 -160,0 z">
41      </animateMotion>
42    </path>
43    <path fill="red" d="M-5,-5 L10,0 L-5,5 L0,0 Z">
44      <animateMotion dur="2000" repeatCount="indefinite" rotate="auto-reverse"path="m40,130 c0,-100 160,100 160,0 c0,-100,-160,100 -160,0 z">
45      </animateMotion>
46    </path>
47    <path fill="red" d="M-5,-5 L10,0 L-5,5 L0,0 Z">
48      <animateMotion dur="2000" repeatCount="indefinite" rotate="45"path="m40,200 c0,-100 160,100 160,0 c0,-100 -160,100 -160,0 z"></animateMotion>
49    </path>
50  </svg>
51</div>
52```
53
54
55![zh-cn_image_0000001213381209](figures/zh-cn_image_0000001213381209.gif)
56