1e41f4b71Sopenharmony_ci# Property Animation (animation) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciWith property animations, you can animate changes to certain component properties, such as [width](ts-universal-attributes-size.md#width), [height](ts-universal-attributes-size.md#height), [backgroundColor](ts-universal-attributes-background.md#backgroundcolor), [opacity](ts-universal-attributes-opacity.md#opacity), [scale](ts-universal-attributes-transformation.md#scale), [rotate](ts-universal-attributes-transformation.md#rotate) and [translate](ts-universal-attributes-transformation.md#translate). In a property animation that involves width and height changes, a component's content (such as text, [canvas](ts-components-canvas-canvas.md#canvas) content, and [linear gradient](ts-universal-attributes-gradient-color.md#lineargradient)) is changed straight to the final state. To enable the content to change with the width and height during the animation process, use the [renderFit](ts-universal-attributes-renderfit.md#renderfit) attribute. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> **Widget capability**: This API can be used in ArkTS widgets since API version 9. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci## APIs 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_cianimation(value:AnimateParam) 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Parameters** 18e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 19e41f4b71Sopenharmony_ci| ----- | --------------------------------- | ---- | ------------------------------------- | 20e41f4b71Sopenharmony_ci| value | [AnimateParam](ts-explicit-animation.md#animateparam) | Yes | Animation settings. | 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci## Example 23e41f4b71Sopenharmony_ci```ts 24e41f4b71Sopenharmony_ci// xxx.ets 25e41f4b71Sopenharmony_ci@Entry 26e41f4b71Sopenharmony_ci@Component 27e41f4b71Sopenharmony_cistruct AttrAnimationExample { 28e41f4b71Sopenharmony_ci @State widthSize: number = 250 29e41f4b71Sopenharmony_ci @State heightSize: number = 100 30e41f4b71Sopenharmony_ci @State rotateAngle: number = 0 31e41f4b71Sopenharmony_ci @State flag: boolean = true 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci build() { 34e41f4b71Sopenharmony_ci Column() { 35e41f4b71Sopenharmony_ci Button('change size') 36e41f4b71Sopenharmony_ci .onClick(() => { 37e41f4b71Sopenharmony_ci if (this.flag) { 38e41f4b71Sopenharmony_ci this.widthSize = 150 39e41f4b71Sopenharmony_ci this.heightSize = 60 40e41f4b71Sopenharmony_ci } else { 41e41f4b71Sopenharmony_ci this.widthSize = 250 42e41f4b71Sopenharmony_ci this.heightSize = 100 43e41f4b71Sopenharmony_ci } 44e41f4b71Sopenharmony_ci this.flag = !this.flag 45e41f4b71Sopenharmony_ci }) 46e41f4b71Sopenharmony_ci .margin(30) 47e41f4b71Sopenharmony_ci .width(this.widthSize) 48e41f4b71Sopenharmony_ci .height(this.heightSize) 49e41f4b71Sopenharmony_ci .animation({ 50e41f4b71Sopenharmony_ci duration: 2000, 51e41f4b71Sopenharmony_ci curve: Curve.EaseOut, 52e41f4b71Sopenharmony_ci iterations: 3, 53e41f4b71Sopenharmony_ci playMode: PlayMode.Normal 54e41f4b71Sopenharmony_ci }) 55e41f4b71Sopenharmony_ci Button('change rotate angle') 56e41f4b71Sopenharmony_ci .onClick(() => { 57e41f4b71Sopenharmony_ci this.rotateAngle = 90 58e41f4b71Sopenharmony_ci }) 59e41f4b71Sopenharmony_ci .margin(50) 60e41f4b71Sopenharmony_ci .rotate({ angle: this.rotateAngle }) 61e41f4b71Sopenharmony_ci .animation({ 62e41f4b71Sopenharmony_ci duration: 1200, 63e41f4b71Sopenharmony_ci curve: Curve.Friction, 64e41f4b71Sopenharmony_ci delay: 500, 65e41f4b71Sopenharmony_ci iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. 66e41f4b71Sopenharmony_ci playMode: PlayMode.Alternate, 67e41f4b71Sopenharmony_ci expectedFrameRateRange: { 68e41f4b71Sopenharmony_ci min: 20, 69e41f4b71Sopenharmony_ci max: 120, 70e41f4b71Sopenharmony_ci expected: 90, 71e41f4b71Sopenharmony_ci } 72e41f4b71Sopenharmony_ci }) 73e41f4b71Sopenharmony_ci }.width('100%').margin({ top: 20 }) 74e41f4b71Sopenharmony_ci } 75e41f4b71Sopenharmony_ci} 76e41f4b71Sopenharmony_ci``` 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci 79