Methods that return objects that contain various internal fields of the timeline (such as isPaused
from getStatus()
).
Methods that control the playback of the animation timeline.
Number of sequences in this timeline.
The highest level of this timeline's lineage.
Adds one or more AnimSequence objects to the end of the timeline.
Rest
...animSequences: AnimSequence[]comma-separated list of animation sequences
Adds one or more AnimSequence objects to the specified index of the sequence.
the index at which the sequences should be inserted
Rest
...animSequences: AnimSequence[]comma-separated list of animation sequences
Finds the index of a given AnimSequence object within the timeline
the animation sequence to search for within the timeline
the index of animSequence within the timeline or -1
if the sequence is not part of the timeline.
Removes one or more AnimSequence objects from the timeline.
Rest
...animSequences: AnimSequence[]comma-separated list of animation sequences
Removes a number of AnimSequence objects from the timeline based on the provided indices range (0-based).
the starting index, inclusive
the ending index, exclusive
an array containing the sequences that were removed from the timeline.
Protected
generateReadonly
idNumber that uniquely identifies the timeline from other timelines. Automatically generated.
Returns an object containing the configuration options used to define the name, debugging behavior, and button-linking behavior of the timeline.
an object containing
Returns details about an timeline's current status.
an object containing
Returns timing-related details about the timeline.
an object containing
Forces the animation sequences that are currently running within the timeline to instantly finish.
Jumps instantly to the position within the timeline based on the position argument.
the target position within the timeline
set of options defining the offset of the jump and whether to consider autoplay
Optional
autoplaydetermines how the timeline should handle sequences set to autoplay once the jump destination (after considering options.targetOffset) has been reached
'none
', the timeline stays at the final landing position after the initial jumping operation.'forward'
, the timeline will jump forward for as long as the next sequence is supposed to autoplay after the current sequence.'backward'
, the timeline will jump backward for as long as the previous sequence as long as the previous sequence is supposed to automatically
rewind after the current sequence is rewound (this is naturally only true when the current sequence is set to autoplay when the timeline steps forward).Optional
targetoffset that adds to the initial landing position
a Promise that resolves when the timeline has finished jumping.
Jumps instantly to the sequence whose AnimSequence.getJumpTag() value matches the jumpTag argument.
string that is used to search for the target sequence with the matching AnimSequence.getJumpTag() value
set of options defining the behavior of the search, the offset of the jump, and whether to consider autoplay
Optional
autoplaydetermines how the timeline should handle sequences set to autoplay once the jump destination (after considering options.targetOffset) has been reached
'none
', the timeline stays at the final landing position after the initial jumping operation.'forward'
, the timeline will jump forward for as long as the next sequence is supposed to autoplay after the current sequence.'backward'
, the timeline will jump backward for as long as the previous sequence is supposed to automatically
rewind after the current sequence is rewound (this is naturally only true when the current sequence is set to autoplay when the timeline steps forward).Optional
search?: the direction and/or the starting point of the search
Optional
searchoffset that changes the starting point of the search by the indicated amount
Optional
targetoffset that adds to the initial landing position
a Promise that resolves when the timeline has finished jumping.
const {Entrance, Motion, Exit} = webimator.createAnimationClipFactories();
const square = document.querySelector('.square');
const tLine = webimator.newTimeline(
webimator.newSequence(
{jumpTag: 'flickering'},
Entrance(square, '~appear', [], {endDelay: 500}),
Exit(square, '~disappear', [], {endDelay: 500}),
Entrance(square, '~appear', [], {endDelay: 500}),
Exit(square, '~disappear', [], {endDelay: 500}),
Entrance(square, '~appear', [], {endDelay: 500}),
Exit(square, '~disappear', [], {endDelay: 500}),
),
webimator.newSequence(
{jumpTag: 'move around'},
Motion(square, '~translate', [{translate: '200px, 0px'}]),
Motion(square, '~translate', [{translate: '0px, 200px'}]),
Motion(square, '~translate', [{translate: '-200px, 0px'}]),
Motion(square, '~translate', [{translate: '0px, -200px'}]),
),
webimator.newSequence(
{jumpTag: 'go away', autoplays: true},
Exit(square, '~pinwheel', []),
)
);
// Promise-based timer
async function wait(milliseconds: number) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
(async () => {
// jump straight to sequence with tag "move around"
await tLine.jumpToSequenceTag('move around');
await wait (1000); // wait 1 second
// jump to sequence whose tag contains "flick"
// (so now we're back at the beginning of the timeline)
await tLine.jumpToSequenceTag(/flick/);
await wait (1000); // wait 1 second
// jump to sequence with tag "move around"
// then look forward to see if any sequences have {autoplays: true}
// the next one does, so it continues, skipping to the third sequence
await tLine.jumpToSequenceTag('move around', {autoplayDetection: 'forward'});
await wait (1000); // wait 1 second
// play the last sequence
await tLine.step('forward');
})();
Takes 1 step in the specified direction.
the direction in which the timeline should step
a Promise that resolves when the timeline has finished stepping.
Turns on skipping if it is currently off or turns it off if it is currently on.
options defining the behavior of the toggle
Optional
forceExplicitly instructs the method to either turn skipping on (equivalent to turnSkippingOn()) or turn skipping off (equivalent to turnSkippingOff())
Makes it so that any sequence that is played is finished instantly.
Returns an object containing the configuration options used to define the name, debugging behavior, and button-linking behavior of the timeline.
an object containing
Object containing properties that are either references to <wbmtr-playback-button>
elements that are connected to this timeline or null
.
null
indicates that there is currently no corresponding button on the page that is linked to this timeline.Disables this timeline's connection to its playback buttons until re-enabled using enablePlaybackButtons().
Allows this timeline's linked playback buttons to trigger (and be triggered by) this timeline's playback methods.
Searches the page for <wbmtr-playback-button>
elements whose
timeline-name
attributes are equivalent to this timeline's timelineName
configuration option,
then links those buttons to this timeline.
Settings to define the behavior of the search
Optional
buttonsArray of strings indicating which specific buttons we want to link. By default, all buttons are searched for
Optional
searchThe HTML element from which to begin searching for the buttons
Methods that relate to building the timeline or locating sequences within it.