W3cubDocs

/DOM

KeyframeEffectReadOnly.spacing

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The spacing property of a KeyframeEffectReadOnly or a KeyframeEffect sets the temporal spacing of the animation's iterations.

Note: For KeyframeEffect, this property is both a getter and a setter. For KeyframeEffectReadOnly, it is read-only.

Syntax

// getting
var keyframesSpacing = keyframeEffect.spacing;

// setting
keyframeEffect.spacing = 'distribute';

Value

The difference between distribute and paced is the difference between time-based and value-based distribution of changes across an animation's duration. See the diagrams for a visual explanation of how the following keyframeEffect's animation will change with these two spacing values.

var keyframes = new KeyframeEffect(
  element,
  [
    { left: '0px' },
    { left: '-20px' },
    { left: '100px' },
    { left: '50px' }
  ],
  1000
);
distribute
Distributes the keyframeEffect's keyframes without offsets so that the difference between subsequent keyframe offsets are equal. That is to say, without any offsets, it will equally distribute the keyframes across play time.

paced({property})
Distributes the keyframeEffect's keyframes without offsets so that the distance between subsequent values of the specified paced property are equal. That is to say, keyframes are spaced further apart the greater the difference in their property values.

Specifications

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

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support No support No support No support No support
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ? ? ?

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffectReadOnly/spacing