Animation Action Settings object literal

See Animation Actions for more information.

interface Literal<Key, ValueType extends AnimatableValueTypes> {
    p?: Key;
    rv?: ValueType;
    t?:
        | string
        | Lightning.Element<
            Lightning.Element.TemplateSpecLoose,
            Lightning.Element.TypeConfigLoose,
        >;
    v?: [ValueType] extends [never] ? never : AnimationActionValue<ValueType>;
}

Type Parameters

Properties

Properties

p?: Key

Property to animate

IMPORTANT: If you'd like to animate nested properties (i.e. 'texture.x', 'shader.angle', 'text.text'), you will need to suffix them with "Force Assertions", since it is not possible to derive their types in the type system:

  • number: as '$$number'
  • string: as '$$string'
  • boolean: as '$$boolean'

See the examples below to see how to use them.

See Action Value for more information.

this.MyStrongElement.animation({
duration: 10,
actions: [
{ p: 'x', v: 100 },
{ p: 'x', v: { 0: 100, 0.25: { v: 200 }, 0.75: { v: 300 }, 1: 400 } },
{ p: 'x', v: (p) => 100 * p },
{ p: 'rtt', v: false },
{ p: 'rtt', v: { 0: false, 0.25: { v: true }, 0.75: { v: false }, 1: true, sm: 0.5 } },
{ p: 'rtt', v: (p) => true },
{ p: 'texture.x' as '$$number', v: 123 },
{ p: 'text.text' as '$$string', v: 'some string' },
{ p: 'text.wordWrap' as '$$boolean', v: true }
]
})

Reset value

After manually stopping the animation, the defined value v at progress 0 is used. If another value is desired, rv can be used.

See Action Value for more information.

t?:
    | string
    | Lightning.Element<
        Lightning.Element.TemplateSpecLoose,
        Lightning.Element.TypeConfigLoose,
    >

Tag selector (see Element.tag function) on which the animation will be applied

  • If you specify this:
    • The child Elements (of the Element you're calling Element.animation on) that match the selector string will be animated.
  • Otherwise:
    • The Element (or object) you are calling animation() on will be animated.

WARNING: Because it's impossible to make tag selection type-safe it is recommended to use a reference when using TypeScript, or call animation() directly on each Element you wish to animate.

v?: [ValueType] extends [never] ? never : AnimationActionValue<ValueType>

Value object decribing animation

See Action Value for more information.