1e41f4b71Sopenharmony_ci# Immediate Delivery of Explicit Animation (animateToImmediately)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **animateToImmediately** API implements immediate delivery for [explicit animations](ts-explicit-animation.md). When multiple property animations are loaded at once, you can call this API to immediately execute the transition animation for state changes caused by the specified closure function.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This feature is supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## APIs
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci## animateToImmediately
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_cianimateToImmediately(value: AnimateParam , event: () => void): void
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciDelivers an explicit animation immediately.
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci**Parameters**
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Name| Type                                                        | Mandatory| Description                                                        |
25e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
26e41f4b71Sopenharmony_ci| value  | [AnimateParam](ts-explicit-animation.md#animateparam) | Yes      | Animation settings.                                      |
27e41f4b71Sopenharmony_ci| event  | () => void                                                   | Yes      | Closure function that displays the animation. The system automatically inserts a transition animation for state changes caused by the closure function.|
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci## Example
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci```ts
32e41f4b71Sopenharmony_ci// xxx.ets
33e41f4b71Sopenharmony_ci@Entry
34e41f4b71Sopenharmony_ci@Component
35e41f4b71Sopenharmony_cistruct AnimateToImmediatelyExample {
36e41f4b71Sopenharmony_ci  @State widthSize: number = 250
37e41f4b71Sopenharmony_ci  @State heightSize: number = 100
38e41f4b71Sopenharmony_ci  @State opacitySize: number = 0
39e41f4b71Sopenharmony_ci  private flag: boolean = true
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci  build() {
42e41f4b71Sopenharmony_ci    Column() {
43e41f4b71Sopenharmony_ci      Column()
44e41f4b71Sopenharmony_ci      .width(this.widthSize)
45e41f4b71Sopenharmony_ci      .height(this.heightSize)
46e41f4b71Sopenharmony_ci      .backgroundColor(Color.Green)
47e41f4b71Sopenharmony_ci      .opacity(this.opacitySize)
48e41f4b71Sopenharmony_ci      Button('change size')
49e41f4b71Sopenharmony_ci        .margin(30)
50e41f4b71Sopenharmony_ci        .onClick(() => {
51e41f4b71Sopenharmony_ci          if (this.flag) {
52e41f4b71Sopenharmony_ci            animateToImmediately({
53e41f4b71Sopenharmony_ci              delay: 0,
54e41f4b71Sopenharmony_ci              duration: 1000
55e41f4b71Sopenharmony_ci            }, () => {
56e41f4b71Sopenharmony_ci              this.opacitySize = 1
57e41f4b71Sopenharmony_ci            })
58e41f4b71Sopenharmony_ci            animateTo({
59e41f4b71Sopenharmony_ci              delay: 1000,
60e41f4b71Sopenharmony_ci              duration: 1000
61e41f4b71Sopenharmony_ci            }, () => {
62e41f4b71Sopenharmony_ci              this.widthSize = 150
63e41f4b71Sopenharmony_ci              this.heightSize = 60
64e41f4b71Sopenharmony_ci            })
65e41f4b71Sopenharmony_ci          } else {
66e41f4b71Sopenharmony_ci            animateToImmediately({
67e41f4b71Sopenharmony_ci              delay: 0,
68e41f4b71Sopenharmony_ci              duration: 1000
69e41f4b71Sopenharmony_ci            }, () => {
70e41f4b71Sopenharmony_ci              this.widthSize = 250
71e41f4b71Sopenharmony_ci              this.heightSize = 100
72e41f4b71Sopenharmony_ci            })
73e41f4b71Sopenharmony_ci            animateTo({
74e41f4b71Sopenharmony_ci              delay: 1000,
75e41f4b71Sopenharmony_ci              duration: 1000
76e41f4b71Sopenharmony_ci            }, () => {
77e41f4b71Sopenharmony_ci              this.opacitySize = 0
78e41f4b71Sopenharmony_ci            })
79e41f4b71Sopenharmony_ci          }
80e41f4b71Sopenharmony_ci          this.flag = !this.flag
81e41f4b71Sopenharmony_ci        })
82e41f4b71Sopenharmony_ci    }.width('100%').margin({ top: 5 })
83e41f4b71Sopenharmony_ci  }
84e41f4b71Sopenharmony_ci}
85e41f4b71Sopenharmony_ci```
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci![animation1](figures/animateToImmediately1.gif)
88