Methods

  • Creates a new AnimSequence with configuration options specified in the config parameter followed by an optional list of animation clips.

    Parameters

    Returns AnimSequence

    A new AnimSequence instance.

    // retrieve clip factory functions
    const clipFactories = webimator.createAnimationClipFactories();
    // select a (presumable) square-shaped element from the DOM
    const squareEl = document.querySelector(".square");

    // create sequence with some configuration options and some animation clips
    const seq = webimator.newSequence(
    { description: "Fade in square, move it, and fade out", playbackRate: 2 },
    clipFactories.Entrance(squareEl, "~fade-in", []),
    clipFactories.Motion(squareEl, "~translate", [{ translate: "200px, 500px" }]),
    clipFactories.Exit(squareEl, "~fade-out", [])
    );
    // play sequence
    seq.play();
    // SAME EXAMPLE BUT WITH DESTRUCTURING ASSIGNMENT FOR THE CLIP FACTORY FUNCTIONS

    const {Entrance, Exit, Motion} = webimator.createAnimationClipFactories();
    const squareEl = document.querySelector('.square');

    const seq = webimator.newSequence(
    {description: 'Fade in square, move it, and fade out', playbackRate: 2},
    Entrance(squareEl, '~fade-in', []),
    Motion(squareEl, '~translate', [{translate: '200px, 500px'}]),
    Exit(squareEl, '~fade-out', []),
    );
    seq.play();
  • Creates a new AnimSequence instance with an optional list of animation clips.

    Parameters

    Returns AnimSequence

    A new AnimSequence instance.

    // retrieve clip factory functions
    const clipFactories = webimator.createAnimationClipFactories();
    // select a (presumable) square-shaped element from the DOM
    const squareEl = document.querySelector('.square');

    // create sequence with some animation clips
    const seq = webimator.newSequence(
    clipFactories.Entrance(squareEl, '~fade-in', []),
    clipFactories.Motion(squareEl, '~translate', [{translate: '200px, 500px'}]),
    clipFactories.Exit(squareEl, '~fade-out', []),
    );
    // play sequence
    seq.play();
    // SAME EXAMPLE BUT WITH DESTRUCTURING ASSIGNMENT FOR THE CLIP FACTORY FUNCTIONS

    const {Entrance, Exit, Motion} = webimator.createAnimationClipFactories();
    const squareEl = document.querySelector('.square');

    const seq = webimator.newSequence(
    Entrance(squareEl, '~fade-in', []),
    Motion(squareEl, '~translate', [{translate: '200px, 500px'}]),
    Exit(squareEl, '~fade-out', []),
    );
    seq.play();
  • Creates a new AnimTimeline with configuration options specified in the config parameter followed by an optional list of animation sequences.

    Parameters

    Returns AnimTimeline

    A new AnimTimeline instance.

    // retrieve some clip factory functions
    const {Entrance, Exit, Motion} = webimator.createAnimationClipFactories();
    // select presumably a square element and a circle element from the DOM
    const squareEl = document.querySelector('.square');
    const circleEl = document.querySelector('.circle');

    // create first sequence
    const seq1 = webimator.newSequence(
    {description: 'Fade in square, move it, and fade out', playbackRate: 2},
    Entrance(squareEl, '~fade-in', []),
    Motion(squareEl, '~translate', [{translate: '200px, 500px'}]),
    Exit(squareEl, '~fade-out', []),
    );

    // create second sequence
    const seq2 = webimator.newSequence(
    {description: 'Fade in circle and move it'},
    Entrance(circleEl, '~fly-in', ['from-left']),
    Motion(circleEl, '~translate', [{translate: '250px, 0px'}]),
    );

    // create timeline with some configuration and both sequences
    const timeline = webimator.newTimeline(
    {timelineName: 'Moving Shapes', autoLinksButtons: true},
    seq1,
    seq2,
    );

    // step forward twice, playing both sequences
    timeline.step('forward')
    .then(() => timeline.step('forward'));
  • Creates a new AnimTimeline with with an optional list of animation sequences.

    Parameters

    Returns AnimTimeline

    A new AnimTimeline instance.

    // retrieve some clip factory functions
    const {Entrance, Exit, Motion} = webimator.createAnimationClipFactories();
    // select presumably a square element and a circle element from the DOM
    const squareEl = document.querySelector('.square');
    const circleEl = document.querySelector('.circle');

    // create first sequence
    const seq1 = webimator.newSequence(
    {description: 'Fade in square, move it, and fade out', playbackRate: 2},
    Entrance(squareEl, '~fade-in', []),
    Motion(squareEl, '~translate', [{translate: '200px, 500px'}]),
    Exit(squareEl, '~fade-out', []),
    );

    // create second sequence
    const seq2 = webimator.newSequence(
    {description: 'Fade in circle and move it'},
    Entrance(circleEl, '~fly-in', ['from-left']),
    Motion(circleEl, '~translate', [{translate: '250px, 0px'}]),
    );

    // create timeline with both sequences
    const timeline = webimator.newTimeline(
    seq1,
    seq2,
    );