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.
The number of sequences in this timeline.
The highest level of this timeline's lineage.
Adds AnimSequence objects to the end of the timeline.
An array of animation sequences to add.
Adds AnimSequence objects to the specified location within the timeline.
Object containing options specifying the location at which the sequences should be inserted.
An array of animation sequences to add.
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 specified AnimSequence objects from the timeline.
An array of animation sequences to remove.
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 (if not specified, startIndex + 1 is used, removing one sequence).
An array containing the sequences that were removed from the timeline.
ProtectedgenerateReadonlyidA number 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 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.
An options object defining the offset of the jump and whether to consider autoplay.
OptionalautoplayDetection?: "none" | "forward" | "backward"Determines 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).OptionaltargetOffset?: numberAn offset 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.
The string that is used to search for the target sequence with the matching AnimSequence.getJumpTag() value.
An options object defining the behavior of the search, the offset of the jump, and whether to consider autoplay.
OptionalautoplayDetection?: "none" | "forward" | "backward"Determines 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).Optionalsearch?: "forward" | "backward" | "forward-from-beginning" | "backward-from-end"The direction and/or the starting point of the search.
OptionalsearchOffset?: numberAn offset that changes the starting point of the search by the indicated amount.
OptionaltargetOffset?: numberAn offset that adds to the initial landing position.
A Promise that resolves when the timeline has finished jumping.
const {Entrance, Motion, Exit} = webchalk.createAnimationClipFactories();
const square = document.querySelector('.square');
const tLine = webchalk.newTimeline(
[
webchalk.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}),
]
),
webchalk.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'}]),
]
),
webchalk.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');
})();
Pauses the animation timeline.
Sets the base playback rate of the timeline.
The new playback rate.
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.
Pauses the animation timeline if it is unpaused or unpauses it if it is currently paused.
An options object specifying the behavior of the toggle.
OptionalforceState?: "pause" | "unpause"Turns on skipping if it is currently off or turns it off if it is currently on.
An options object defining the behavior of the toggle.
OptionalforceState?: "off" | "on"Explicitly 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.
Unpauses the animation timeline.
Returns an object containing the configuration options used to define the name, debugging behavior, and button-linking behavior of the timeline.
An object containing
ProtectedgenerateObject containing properties that are either references to <webchalk-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 <webchalk-playback-button> elements whose
timeline-name attributes are equivalent to this timeline's timelineName configuration option,
then links those buttons to this timeline.
An object containing settings to define the behavior of the search
OptionalbuttonsSubset?: PlaybackButtonPurpose[]An array of strings indicating which specific buttons we want to link. By default, all buttons are searched for.
OptionalsearchRoot?: HTMLElementThe HTML element from which to begin searching for the buttons.
Methods that relate to building the timeline or locating sequences within it.