style
Declares a key/value object containing CSS properties/styles that
can then be used for an animation state
, within an animation sequence
,
or as styling data for calls to animate()
and keyframes()
.
style(tokens: '*' | {
[key: string]: string | number;
} | Array<'*' | {
[key: string]: string | number;
}>): AnimationStyleMetadata
Parameters
Returns
AnimationStyleMetadata
: An object that encapsulates the style data.
Usage notes
The following examples create animation styles that collect a set of CSS property values:
// string values for CSS properties
style({ background: "red", color: "blue" })
// numerical pixel values
style({ width: 100, height: 0 })
The following example uses auto-styling to allow a component to animate from a height of 0 up to the height of the parent element:
style({ height: 0 }),
animate("1s", style({ height: "*" }))