1e41f4b71Sopenharmony_ci# Using Animations in the Widget
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciTo make your ArkTS widget more engaging, you can apply animations to it, including [explicit animation](../reference/apis-arkui/arkui-ts/ts-explicit-animation.md), [property animation](../reference/apis-arkui/arkui-ts/ts-animatorproperty.md), and [component transition](../reference/apis-arkui/arkui-ts/ts-transition-animation-component.md). Just note the following restrictions when using the animations in ArkTS widgets.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci**Table 1** Restrictions on animation parameters
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci| Name| Description| Description|
9e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
10e41f4b71Sopenharmony_ci| duration | Animation playback duration| The maximum value is 1 second. If a larger value is set, the animation is still played for 1 second.|
11e41f4b71Sopenharmony_ci| tempo | Animation playback speed.| Do not set this parameter in the widget. Use the default value 1.|
12e41f4b71Sopenharmony_ci| delay | Animation delay duration.| Do not set this parameter in the widget. Use the default value 0.|
13e41f4b71Sopenharmony_ci| iterations | Number of times that the animation is played.| Do not set this parameter in the widget. Use the default value 1.|
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci>**NOTE**
16e41f4b71Sopenharmony_ci>
17e41f4b71Sopenharmony_ci>Static widgets do not support animations.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciThe following sample code implements the animation effect of button rotation.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci![WidgetAnimation](figures/WidgetAnimation.gif)
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci```ts
26e41f4b71Sopenharmony_ci@Entry
27e41f4b71Sopenharmony_ci@Component
28e41f4b71Sopenharmony_cistruct AnimationCard {
29e41f4b71Sopenharmony_ci  @State rotateAngle: number = 0;
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci  build() {
32e41f4b71Sopenharmony_ci    Row() {
33e41f4b71Sopenharmony_ci      Button('change rotate angle')
34e41f4b71Sopenharmony_ci        .height('20%')
35e41f4b71Sopenharmony_ci        .width('90%')
36e41f4b71Sopenharmony_ci        .margin('5%')
37e41f4b71Sopenharmony_ci        .onClick(() => {
38e41f4b71Sopenharmony_ci          this.rotateAngle = (this.rotateAngle === 0 ? 90 : 0);
39e41f4b71Sopenharmony_ci        })
40e41f4b71Sopenharmony_ci        .rotate({ angle: this.rotateAngle })
41e41f4b71Sopenharmony_ci        .animation({
42e41f4b71Sopenharmony_ci          curve: Curve.EaseOut,
43e41f4b71Sopenharmony_ci          playMode: PlayMode.Normal,
44e41f4b71Sopenharmony_ci        })
45e41f4b71Sopenharmony_ci    }.height('100%').alignItems(VerticalAlign.Center)
46e41f4b71Sopenharmony_ci  }
47e41f4b71Sopenharmony_ci}
48e41f4b71Sopenharmony_ci```
49