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