@angular/animationslink
Implements a domain-specific language (DSL) for defining web animation sequences for HTML elements as multiple transformations over time.
Use this API to define how an HTML element can move, change color, grow or shrink, fade, or slide off the page. These changes can occur simultaneously or sequentially. You can control the timing of each of these transformations. The function calls generate the data structures and metadata that enable Angular to integrate animations into templates and run them based on application states.
Animation definitions are linked to components through the animations
property in the @Component
metadata, typically in the component file of the HTML element to be animated. The trigger()
function encapsulates a named animation, with all other function calls nested within. Use the trigger name to bind the named animation to a specific triggering element in the HTML template.
Angular animations are based on CSS web transition functionality, so anything that can be styled or transformed in CSS can be animated the same way in Angular. Angular animations allow you to:
- Set animation timings, styles, keyframes, and transitions.
- Animate HTML elements in complex sequences and choreographies.
- Animate HTML elements as they are inserted and removed from the DOM, including responsive real-time filtering.
- Create reusable animations.
- Animate parent and child elements.
Additional animation functionality is provided in other Angular modules for animation testing, for route-based animations, and for programmatic animation controls that allow an end user to fast forward and reverse an animation sequence.
参见
Find out more in the animations guide.
See what polyfills you might need in the browser support guide.
入口点
主要
@angular/animations | Implements a domain-specific language (DSL) for defining web animation sequences for HTML elements as multiple transformations over time. |
次要
@angular/animations/browser | |
@angular/animations/browser/testing |
导出列表
类
AnimationBuilder | AnimationBuilder is an injectable service that is available when the BrowserAnimationsModule or NoopAnimationsModule modules are used within an application. |
AnimationFactory | An instance of |
NoopAnimationPlayer |
函数
animate | Defines an animation step that combines styling information with timing information. 定义一个动画步骤,它把一些样式信息和时序信息组合在一起。 |
animateChild | Executes a queried inner animation element within an animation sequence. 在一个动画序列中执行一个查询到的内部动画元素。 |
animation | Produces a reusable animation that can be invoked in another animation or sequence, by calling the 生成一个可复用的动画,可以在其它动画或序列中通过 |
group | Defines a list of animation steps to be run in parallel. 定义一个可以并行运行的动画步骤列表。 |
keyframes | Defines a set of animation styles, associating each style with an optional 可定义一组动画样式,每个样式都关联着一个可选的 |
query | Finds one or more inner elements within the current element that is being animated within a sequence. Use with 在动画序列中正在播放的元素中查找一个或多个内部元素。和 |
sequence | Defines a list of animation steps to be run sequentially, one by one. 定义一个动画步骤列表,逐个依次运行它们。 |
stagger | Use within an animation 在调用 |
state | Declares an animation state within a trigger attached to an element. 在附加到元素的触发器上,声明一个动画状态。 |
style | Declares a key/value object containing CSS properties/styles that can then be used for an animation 声明一个包含 CSS 属性/样式的键值对象,可在动画序列中用作动画状态( |
transition | Declares an animation transition as a sequence of animation steps to run when a given condition is satisfied. The condition is a Boolean expression or function that compares the previous and current animation states, and returns true if this transition should occur. When the state criteria of a defined transition are met, the associated animation is triggered. 声明一个转场动画,以便在满足给定条件时运行一系列动画步骤。该条件是一个逻辑型表达式或一个函数, 该函数比较以前和现在的动画状态,如果应该开始转场则返回 |
trigger | Creates a named animation trigger, containing a list of 创建一个有名字的动画触发器,包含一个 |
useAnimation | Starts a reusable animation that is created using the 启动一个使用 |
结构
AnimationEvent | |
AnimateChildOptions | Adds duration options to control animation styling and timing for a child animation. 添加持续时间选项,以控制子动画的动画样式和时序。 |
AnimationAnimateChildMetadata | Encapsulates a child animation, that can be run explicitly when the parent is run. Instantiated and returned by the 封装一个子动画,父动画可以显式的运行它。 由 |
AnimationAnimateMetadata | Encapsulates an animation step. Instantiated and returned by the 封装一个动画步骤。由 |
AnimationAnimateRefMetadata | Encapsulates a reusable animation. Instantiated and returned by the 封装一个可复用的动画。 由 |
AnimationGroupMetadata | Encapsulates an animation group. Instantiated and returned by the 封装一个动画组。 由 |
AnimationKeyframesSequenceMetadata | Encapsulates a keyframes sequence. Instantiated and returned by the 封装一个关键帧序列。由 |
AnimationMetadata | Base for animation data structures. 动画数据结构的基类。 |
AnimationMetadataType | Constants for the categories of parameters that can be defined for animations. 一组可以为动画定义参数类别的常量。 |
AnimationOptions | Options that control animation styling and timing. 用来控制动画样式和时序的选项。 |
AnimationQueryMetadata | Encapsulates an animation query. Instantiated and returned by the 封装一个动画查询。由 |
AnimationQueryOptions | Encapsulates animation query options. Passed to the 封装一些动画查询选项。 传给 |
AnimationReferenceMetadata | Encapsulates a reusable animation, which is a collection of individual animation steps. Instantiated and returned by the 封装一个可复用的动画,包括一组独立的动画步骤。由 |
AnimationSequenceMetadata | Encapsulates an animation sequence. Instantiated and returned by the 封装一个动画序列。 由 |
AnimationStaggerMetadata | Encapsulates parameters for staggering the start times of a set of animation steps. Instantiated and returned by the 封装一组动画步骤的起始时间的交错参数。 由 |
AnimationStateMetadata | Encapsulates an animation state by associating a state name with a set of CSS styles. Instantiated and returned by the 通过将状态名称和一组 CSS 样式相关联来封装一个动画状态。 由 |
AnimationStyleMetadata | Encapsulates an animation style. Instantiated and returned by the 封装一个动画样式。由 |
AnimationTransitionMetadata | Encapsulates an animation transition. Instantiated and returned by the 封装一个转场动画。由 |
AnimationTriggerMetadata | Contains an animation trigger. Instantiated and returned by the 包含一个动画触发器。由 |
AnimationPlayer | AnimationPlayer controls an animation sequence that was produced from a programmatic animation. (see AnimationBuilder for more information on how to create programmatic animations.) |
类型
AUTO_STYLE | Specifies automatic styling. 用于指定自动化样式。 |
AnimateTimings | Represents animation-step timing parameters for an animation step. 表示一个动画步骤中的动画时序参数。 |