Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Simple

Choose from a variety of basic 2D animations.

See SimpleEffects for a list of effects to choose from and their options.

Basic Usage

new Simple()
  .set('shake')
  .get();

Hierarchy

Index

Constructors

Methods

Constructors

constructor

Methods

abort

  • abort(): void

applyTo

  • applyTo(el: HTMLElement | HTMLElement[], options?: ApplyToOptions): Promise<void>
  • Apply this animation to an HTML element or array of HTML elements. Embeds a style element in the HTML document with the animations and keyframes, and then sets the CSS of the given HTML elements to use those animations.

    Parameters

    • el: HTMLElement | HTMLElement[]
    • Default value options: ApplyToOptions = {}

    Returns Promise<void>

    Promise that resolves once the animation is completed and the animation style removed. Infinite animations never resolve.

get

  • get<ReturnType>(type?: ReturnType, options?: KeyframeOptions): KeyframeReturnTypeMap[ReturnType]
  • Retrieve keyframes to embed as CSS or as an array of Animation Keyframe objects to use with Web Animation API.

    Type parameters

    Parameters

    Returns KeyframeReturnTypeMap[ReturnType]

    CSS or array of objects depending on the type given

set

  • set<K>(effect: K, options?: SimpleEffects[K]): this
  • Sets the simple effect to use.

    Type parameters

    Parameters

    • effect: K

      Name of the effect

    • Optional options: SimpleEffects[K]

      Specific effect options

    Returns this

Static isSupported

  • isSupported(): boolean