We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

AnimationEffectTimingReadOnly.delay

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The delay property of the AnimationEffectTimingReadOnly object represents the number of milliseconds to delay the start of the animation.

Note: In AnimationEffectTiming, a mutable subclass of AnimationEffectTimingReadOnly used withKeyframeEffects, the property acts as both a getter and a setter.

Syntax

// Getting the delay in milliseconds
var animationDelay = animation.effect.timing.delay;

// Setting the delay in milliseconds 
animation.effect.timing.delay = 200;

Value

A number specifying the delay, in milliseconds, from the start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). Defaults to 0.

Examples

In the Growing and Shrinking Alice example, we set a delay of 2000 milliseconds (2 seconds) on an animation that shows a "game over" tile. At the end of the game, for two seconds a vignette is shown before the "game over" interface appears. Below you can see that even though we call play() immediately after setting the delay, the animation will wait two second before begining:

bringUI.effect.timing.delay = 2000;
bringUI.play();

Specifications

Specification Status Comment
Web Animations
The definition of 'AnimationEffectTimingReadOnly.delay' in that specification.
Working Draft Editor's draft.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes ?451 2 No Yes No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support ? ? ?451 2 No No ?

1. The preference is set to true by default on Firefox Nightly and on Firefox Developer Edition, but not on the official release.

2. From version 45: this feature is behind the dom.animations-api.core-enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

See also

Document Tags and Contributors

Contributors to this page: fscholz, rachelnabors, chrisdavidmills
Last updated by: fscholz,