group

Defines a list of animation steps to be run in parallel.

定义一个可以并行运行的动画步骤列表。

group(steps: AnimationMetadata[], options: AnimationOptions | null = null): AnimationGroupMetadata

参数

steps

An array of animation step objects.

一个由动画步骤对象构成的数组。

  • When steps are defined by style() or animate() function calls, each call within the group is executed instantly.

    当步骤由 style()animate() 的函数调用定义时,组中的每个调用都会立即执行。

  • To specify offset styles to be applied at a later time, define steps with keyframes(), or use animate() calls with a delay value.

    要指定供带有延迟的偏移样式,请使用 keyframes() 调用来定义步骤;如果要指定延迟的时长,则改用 animate() 调用。

For example:

例如:

group([ animate("1s", { background: "black" })) animate("2s", { color: "white" })) ])
options

An options object containing a delay and developer-defined parameters that provide styling defaults and can be overridden on invocation.

一个配置对象,包含一个延迟和一些由开发人员定义的参数,这些参数用于提供样式的默认值,并可在调用时重写。

可选. 默认值是 null.

返回值

AnimationGroupMetadata: An object that encapsulates the group data.

一个封装了该组数据的对象。

使用说明

Grouped animations are useful when a series of styles must be animated at different starting times and closed off at different ending times.

当一系列样式分别需要在不同的起始时间开始动画并在不同的结束时间停止时,分组动画非常有用。

When called within a sequence() or a transition() call, does not continue to the next instruction until all of the inner animation steps have completed.

当在 sequence()transition() 中调用它时,除非完成所有内部动画步骤,否则不会执行后续步骤。