1e41f4b71Sopenharmony_ci# Animation Attributes
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciAny type of animations consists of the following attributes: duration, curve, and frame rate.  Different combinations of these attributes can create animations of different styles and characteristics, such as steady, lightheartedly, merry, and soothing.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci## Duration
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ciAnimation duration varies according to the types of elements and scenarios. Animations that last too long or too short will make users uncomfortable. The following factors should be considered to enable the duration to accommodate different types of animations.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## Unit
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ciThe animation duration is usually in milliseconds (ms). 1 second equals 1000 milliseconds. When the frame rate is 60 fps, one frame is equal to 16.67 ms.
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## Complexity
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ciIt takes more time to express complex animations than simple animations. And animations should be designed based on the characteristics of graphics.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci|![en-us_media_0000001517612956.gif](figures/en-us_media_0000001517612956.gif) |![en-us_media_0000001517293422.gif](figures/en-us_media_0000001517293422.gif) |
21e41f4b71Sopenharmony_ci| -------- | -------- |
22e41f4b71Sopenharmony_ci| **Simple animation**<br>The status change is expressed only through the change of colors. Duration: 100 ms| **Complex animation**<br>A rotation animation takes some time to display. Duration: 300 ms|
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci## Regions
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ciThe motion of an animation takes place within a certain range, and a small range movement takes less time than a full-screen movement.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci| ![en-us_media_0000001517293402.gif](figures/en-us_media_0000001517293402.gif) | ![en-us_media_0000001517133838.gif](figures/en-us_media_0000001517133838.gif) | ![en-us_media_0000001568212977.gif](figures/en-us_media_0000001568212977.gif) |
30e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
31e41f4b71Sopenharmony_ci| **Movement in a small range**<br>Toggle. Duration: 150 ms| **Movement in some areas**<br>Deleting a list. Duration: 200 ms| **Movement in full-screen**<br>Opening an image. Duration: 350 ms|
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci## Curves
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ciThe curve and duration cooperate with each other to produce the rhythm of motion. By adjusting the curve, you can make an animated object speed up or slow down, rather than moving at a constant speed. The movement of objects in the real world takes time to accelerate and slow down.
37e41f4b71Sopenharmony_ci![curve-1.gif](figures/curve-1.gif)
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciTransitions without moderating curves are stiff and mechanical.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci## Animation Curves
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ciThe animation curve, also known as the animation interpolator, is essentially a method of adjusting the speed of the moving object on the time line.
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci|![animation-curve-linear.jpg](figures/animation-curve-linear.jpg)| ![animation-curve-linear-easing.jpg](figures/animation-curve-linear-easing.jpg)| ![animation-curve-linear-spring.jpg](figures/animation-curve-linear-spring.jpg)|![animation-curve-linear-others.jpg](figures/animation-curve-linear-others.jpg)|
46e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
47e41f4b71Sopenharmony_ci| Linear | Easing| Spring| Others|
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci## Bezier Curve
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ciBezier curve is a mathematical curve and is widely used in animation design. By form, it can be divided into standard curve, deceleration curve, and acceleration curve.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci### Standard Curve
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ciThe object is stationary at the start, accelerates to a peak velocity, and then slows down to become stationary again at the end. The acceleration phase takes less time than the deceleration phase.
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ciUsage: Use the standard curve for objects that remain within the users' line of sight before and after movement, to create realism and credibility.
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ciScenarios: image zooming, tab switching, and switch toggling on/off.
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci![standard-curve-1.gif](figures/standard-curve-1.gif)
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_cicubic-bezier(0.40,0.00,0.20,1.00)
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci### Other Types of Standard Curves
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci| ![standard-curve-cubic-bezier-(0.20,0.00,0.10,1.00).jpg](figures/standard-curve-cubic-bezier-(0.20,0.00,0.10,1.00).jpg)| ![standard-curve-cubic-bezier-(0.33,0.00,0.67,1.00).jpg](figures/standard-curve-cubic-bezier-(0.33,0.00,0.67,1.00).jpg)|
70e41f4b71Sopenharmony_ci| -------- | -------- |
71e41f4b71Sopenharmony_ci| cubic-bezier(0.20,0.00,0.10,1.00) | cubic-bezier(0.33,&nbsp;0.00,&nbsp;0.67,&nbsp;1.00) |
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci### Deceleration Curve
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ciThe object moves at the highest speed at the beginning, gradually slows down over the course, and halts entirely at the end.
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ciUsage: Use the deceleration curve for objects that appear in the line of sight. The natural slowdown at the end allows human eyes to follow the objects.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ciScenarios: appearing of dialog boxes.
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci![deceleration-curve-1.gif](figures/deceleration-curve-1.gif)
83e41f4b71Sopenharmony_cicubic-bezier(0.00, 0.00, 0.40, 1.00)
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci### Other Types of Deceleration Curves
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci| ![deceleration-curve-cubic-bezier-(0.00,0.00,0.20,1.00).jpg](figures/deceleration-curve-cubic-bezier-(0.00,0.00,0.20,1.00).jpg)| ![deceleration-curve-cubic-bezier-(0.00,0.00,0.00,1.00).jpg](figures/deceleration-curve-cubic-bezier-(0.00,0.00,0.00,1.00).jpg)|
89e41f4b71Sopenharmony_ci| -------- | -------- |
90e41f4b71Sopenharmony_ci| cubic-bezier(0.00,&nbsp;0.00,&nbsp;0.20,&nbsp;1.00) | cubic-bezier(0.00,&nbsp;0.00,&nbsp;0.00,&nbsp;1.00) |
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci### Acceleration Curve
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ciThe object is stationary at the beginning, then starts slowly, and ends fast at full velocity.
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ciUsage: Use the acceleration curve for objects moving out.
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ciScenarios: exiting of dialog boxes and deleting widgets.
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci![acceleration-curve-1.gif](figures/acceleration-curve-1.gif)
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci## Spring Curve
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ciSpring curve is a physical curve in which the speed variable is used as a parameter in the curve formula. The same group of parameters can generate different curves at different speeds. Physical attribute parameters, such as stiffness and damping, are used to produce natural spring effect.
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci### Interpolating Spring Curve
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ciThe interpolation spring curve is determined by four physical attributes: stiffness, damping, mass, and velocity.
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci| Name| Description|
113e41f4b71Sopenharmony_ci| -------- | -------- |
114e41f4b71Sopenharmony_ci| Stiffness| Extent to which an object resists deformation in response to an applied force.|
115e41f4b71Sopenharmony_ci| Damping| Force that converges the vibration of the spring by the shock absorber. Damping reduces the amplitude of the spring over time until the spring stops.|
116e41f4b71Sopenharmony_ci| Mass| Mass of the object attached to the spring.|
117e41f4b71Sopenharmony_ci| Velocity| Initial velocity of the object attached to the spring.|
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci### Spring Motion and Responsive Spring Motion Curves
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ciThe spring motion and responsive spring motion curves are determined by response, damping fraction, and overlap duration.
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci| Name| Description|
125e41f4b71Sopenharmony_ci| -------- | -------- |
126e41f4b71Sopenharmony_ci| Response| Period of the undamped natural oscillation.|
127e41f4b71Sopenharmony_ci| Damping fraction| Damping applied to the animation value.|
128e41f4b71Sopenharmony_ci| Overlap duration| Duration for animations to overlap, in seconds.|
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ciThe interpolation spring curve type and the spring motion or responsive spring motion curve type can be converted to each other to produce the same animation effect.
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci![en-us_image_0000001682083252.gif](figures/en-us_image_0000001682083252.gif)
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ciInterpolating spring: Stiffness: 128, Damping: 12, Msss: 1, Velocity: 0
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ciSpring motion: Response: 0.555, DampingFraction :0.53
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci### Critical Damping
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ciCritical damping allows objects to reach the stable equilibrium state in the minimum amount of time without oscillating.
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci![en-us_media_0000001517453000](figures/damping.gif)
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ci### Underdamped
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ciThe damping is weak, and objects consume rigid energy by oscillations and finally achieve a stable equilibrium state.
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ci![2-2-9_elastic-curve-underdamped](figures/2-2-9_elastic-curve-underdamped.gif)
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci### Overdamped
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ciWhen the damping is too large, the motion curve of objects is attenuated more slowly, and finally the stable equilibrium state is achieved.
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci![en-us_media_0000001517293426](figures/en-us_media_0000001517293426.gif)
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci### Characteristics of Elastic Curves
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci**Automatic Matching of Interruptible Duration**
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci- Interruption means an update to the status of the target point. The new animation inherits the velocity of the previous one, delivering a natural transition experience.
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci- The interruption time is not fixed. After the interruption, the animation motion duration is naturally matched. For inelastic curves, the duration must be manually specified.
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**Velocity Inheritance**
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci- Under the same group of elastic curve parameters, different velocity values are passed in, changing the curve form to some extent. This makes the motion more user-friendly.
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci**Natural Duration**
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci- The duration is affected by the elastic parameters, attribute changes, velocity passed in, and precision algorithm.
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci- The elastic curve is a physical model, and the automatic calculation of the motion duration is more in line with the natural law.
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ci### Design Principles
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ciUsage: Use the elastic curve for objects that move with the hand or that need to display the spring characteristics.
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ciScenarios: scrolling the list up and down, turning pages left and right on the home screen, and sliding up to exit the application.
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ci#### Gesture Animations
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci| ![en-us_image_0000001682066508.gif](figures/en-us_image_0000001682066508.gif) |![en-us_image_0000001730067837.gif](figures/en-us_image_0000001730067837.gif) |
185e41f4b71Sopenharmony_ci| -------- | -------- |
186e41f4b71Sopenharmony_ci| Hand speed inherited (Kinetic Energy)| Hand speed not inherited (potential energy)|
187e41f4b71Sopenharmony_ci| ![11](figures/finger-up.png) Fling (Fast/Slow)| ![en-us_image_0000001682069184.png](figures/en-us_image_0000001682069184.png) Long press|
188e41f4b71Sopenharmony_ci|  |![en-us_image_0000001729948773.png](figures/en-us_image_0000001729948773.png) Drag and drop|
189e41f4b71Sopenharmony_ci|  | ![en-us_image_0000001681910020.png](figures/en-us_image_0000001681910020.png) Touch and lift|
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_ci#### Transition Animations
193e41f4b71Sopenharmony_ci
194e41f4b71Sopenharmony_ci|![en-us_image_0000001729959549.gif](figures/en-us_image_0000001729959549.gif) | ![en-us_image_0000001681920780.gif](figures/en-us_image_0000001681920780.gif)|
195e41f4b71Sopenharmony_ci| -------- | -------- |
196e41f4b71Sopenharmony_ci| Transition animation of level switching| Prompt event entry animation|
197e41f4b71Sopenharmony_ci
198e41f4b71Sopenharmony_ci#### Micro Animations
199e41f4b71Sopenharmony_ci
200e41f4b71Sopenharmony_ciMicro animations apply the effect of multiple oscillations to a small-sized element. (Research based on human factors is required.)
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_ci|![en-us_image_0000001682083252.gif](figures/en-us_image_0000001682083252.gif) |![en-us_image_0000001729962573.gif](figures/en-us_image_0000001729962573.gif) |
203e41f4b71Sopenharmony_ci| -------- | -------- |
204e41f4b71Sopenharmony_ci| Icon micro animation example 1| Icon micro animation example 2|
205e41f4b71Sopenharmony_ci
206e41f4b71Sopenharmony_ciFor details about the elastic curve, see [Spring Curve](../../application-dev/ui/arkts-spring-curve.md).
207e41f4b71Sopenharmony_ci
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ci## Frame Rate
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ciFrame rate is given in the number of frames per second (FPS). To allow animations to be perceived as smooth, the frame rate must be 10 to 12 fps. This is called visual persistence. Faster animations require a higher frame rate to ensure smoothness.
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ci![en-us_media_0000001568212985.gif](figures/en-us_media_0000001568212985.gif)
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ciEffects at different frame rates with the same duration and distance (The differences between 90 fps and 120 fps may not be perceived due to the limitations of the browser player.)
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci
218e41f4b71Sopenharmony_ci### Frame Rate of Interactive Animation
219e41f4b71Sopenharmony_ci
220e41f4b71Sopenharmony_ciThe animation frame rate, consistent with the refresh rate of 60 Hz generally used by mobile device screens, can achieve the best animation effect. Different from watching animations, interactive animations require higher frame rate stability. Otherwise, frame freezing may occur.
221e41f4b71Sopenharmony_ci
222e41f4b71Sopenharmony_ci|![1_en-us_media_0000001517452982.gif](figures/1_en-us_media_0000001517452982.gif)|![1_en-us_media_0000001517452981.gif](figures/1_en-us_media_0000001517452981.gif)|
223e41f4b71Sopenharmony_ci| -------- | -------- |
224e41f4b71Sopenharmony_ci| 60 FPS | 30 FPS |
225e41f4b71Sopenharmony_ci
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci### Pure Animation Frame Rate
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ciPure animations, such as the operation guide animation, do not require frame rate as high as that of interactive animations. The basic frame rate of the early Disney hand-painted animation is 24 fps, which can also meet the requirements for smooth watching. Animations with a higher frame rate deliver a more delicate visual experience, especially for fast-moving animations. The frame rate of 8 fps is used for some animations, which is more of animated style needs.
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_ci|![en-us_media_0000001517452988.gif](figures/en-us_media_0000001517452988.gif) |![en-us_media_0000001517293410.gif](figures/en-us_media_0000001517293410.gif) |
232e41f4b71Sopenharmony_ci| -------- | -------- |
233e41f4b71Sopenharmony_ci| 60 FPS. The animation is smooth and exquisite.| 12 FPS. Due to a low frame rate, the change between two frames of an element is too large, and the intermediate state is missing.|
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci
236e41f4b71Sopenharmony_ci## Style
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ciYou can express different animation effects by adjusting duration and curve parameters for different transitions and features. For example, more use of elastic animation will make the animation style of the product more flexible and lively.
239