目录

Animation Overview

The user interface (UI) is the interface through which users interact with devices, consisting of various visual components (such as buttons and lists). Attributes serve as interfaces for controlling component behavior, and changes in attribute values cause UI changes. Animations can add smooth transition effects when the UI changes, allowing attribute values to gradually change from the initial state to the final state, thereby avoiding the abruptness caused by instantaneous changes and maintaining the user's visual focus.

The purposes of animation include:

Animations can be used in any scenario where transitions need to be added to UI changes, such as device startup, app startup and exit, and pulling down to access the control center. These animations provide users with feedback on their actions and help keep their attention on the interface.

ArkUI provides a variety of animation interfaces (such as attribute animation and transition animation) for driving attribute values to gradually change from their initial values to final values according to the configured animation parameters. Although the parameter values are not absolutely continuous during the change process but rather discrete to some extent, the human eye experiences persistence of vision, so what is ultimately perceived is a "continuous" animation. Each UI change is referred to as an animation frame, which corresponds to one screen refresh. A key metric for determining animation smoothness is the frame rate (FPS), which is the number of animation frames per second — the higher the frame rate, the smoother the animation. In ArkUI, animation parameters include settings such as animation duration and animation curve. The animation curve, as a primary factor, determines how attribute values change over time. Taking a linear animation curve as an example, the attribute value changes from the start value to the end value at a constant speed over the animation duration. Changes that are too fast or too slow can result in a poor visual experience and negatively affect user experience. Therefore, animation parameters — especially the animation curve — must be designed and adjusted based on the specific scenario and curve characteristics.

Animation interfaces drive attribute values to transition continuously from the original state to a new state according to the rules determined by animation parameters, thereby producing a continuous visual effect on the UI. This document is organized as follows to provide usage methods and considerations for various animations, helping developers quickly learn animation.