Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1082898 of KeyframeEffectReadOnly

  • Revision slug: Web/API/KeyframeEffectReadOnly
  • Revision title: KeyframeEffectReadOnly
  • Revision id: 1082898
  • Created:
  • Creator: rachelnabors
  • Is current revision? No
  • Comment initial commit

Revision Content

{{SeeCompatTable}}{{ APIRef("Web Animations API") }}

The KeyframeEffectReadOnly interface of the Web Animations API lets us create sets of animatable properties and values, called keyframes. These can then be played using the {{domxref("Animation.Animation()")}} constructor.

Constructor

{{domxref("KeyframeEffectReadOnly.KeyframeEffectReadOnly()")}}
Returns a new KeyframeEffectReadOnly object instance.

Properties

This interface inherits some of its methods and properties from its parent {{domxref("AnimationEffectReadOnly")}}.

{{domxref("KeyframeEffectReadOnly.composite")}} {{readonlyInline}}
The composite operation property for resolving the property value changes between this and other keyframe effects.
{{domxref("KeyframeEffectReadOnly.iterationComposite")}} {{readonlyInline}}
The iteration composite operation for resolving the property value changes of this keyframe effect.
{{domxref("KeyframeEffectReadOnly.spacing")}} {{readonlyInline}}
The temporal spacing of the keyframe effect's iterations.
{{domxref("KeyframeEffectReadOnly.target")}} {{readonlyInline}}
The element or pseudo-element being animated by this object. This may be null for animations that do not target a specific element.
{{domxref("AnimationEffectReadOnly.timing")}} {{readonlyInline}}
The {{domxref("AnimationEffectTimingReadOnly")}} object associated with the animation containing all the animation's timing values.

Methods

{{domxref("KeyframeEffectReadOnly.getKeyframes()")}} {{readonlyInline}}
Returns the computed keyframes that make up this effect along with their computed keyframe offsets.
{{domxref("AnimationEffectReadOnly.getComputedTiming()")}} {{readonlyInline}}
Returns the calculated, current timing values for this keyframe effect.

Examples

In the Down the Rabbit Hole (with CSS Animations) example, all of Alice's animations are done with CSS. CSS Animations use KeyframeEffectReadOnly objects, so you can't tinker with them directly with the Web Animations API. But you can inspect them like so:

// Have a look at the animations on Alice. 
// Her effect is a KeyframeEffectReadOnly object.
document.getElementById("alice").getAnimations()[0].effect;

// Inspect her timing object. 
document.getElementById("alice").getAnimations()[0].effect.timing;

// See what her current timing values are right now. 
// How do they differ from the above?
document.getElementById("alice").getAnimations()[0].effect.getComputedTiming();

Specifications

Specification Status Comment
{{SpecName('Web Animations', '#keyframeeffectreadonly', 'keyframeEffectReadOnly' )}} {{Spec2('Web Animations')}} Editor's draft.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatNo}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

See also

  • Web Animations API
  • Inherits from {{domxref("AnimationEffectReadOnly")}}; {{domxref("KeyframeEffect")}} inherits from them both.

Revision Source

<p>{{SeeCompatTable}}{{ APIRef("Web Animations API") }}</p>

<p>The <strong><code>KeyframeEffectReadOnly</code></strong>&nbsp;interface of the <a href="/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a> lets us create sets of animatable properties and values, called <strong>keyframes. </strong>These can then be played using the&nbsp;{{domxref("Animation.Animation()")}} constructor.</p>

<h2 id="Constructor">Constructor</h2>

<dl>
 <dt>{{domxref("KeyframeEffectReadOnly.KeyframeEffectReadOnly()")}}</dt>
 <dd>Returns a new <code>KeyframeEffectReadOnly</code>&nbsp;object instance.</dd>
</dl>

<h2 id="Properties">Properties</h2>

<p><em>This interface inherits some of its methods and properties from its parent</em>&nbsp;{{domxref("AnimationEffectReadOnly")}}<em>.</em></p>

<dl>
 <dt>{{domxref("KeyframeEffectReadOnly.composite")}}&nbsp;{{readonlyInline}}</dt>
 <dd>The composite operation property for resolving the property value changes&nbsp;between this and other&nbsp;keyframe effects.</dd>
 <dt>{{domxref("KeyframeEffectReadOnly.iterationComposite")}}&nbsp;{{readonlyInline}}</dt>
 <dd>The iteration composite operation for resolving the property value changes&nbsp;of this keyframe effect.</dd>
 <dt>{{domxref("KeyframeEffectReadOnly.spacing")}}&nbsp;{{readonlyInline}}</dt>
 <dd>The temporal spacing of the keyframe effect's iterations.</dd>
 <dt>{{domxref("KeyframeEffectReadOnly.target")}}&nbsp;{{readonlyInline}}</dt>
 <dd>The element or pseudo-element being animated by this object.&nbsp;This may be <code>null</code> for animations that do not target a specific element.</dd>
 <dt>{{domxref("AnimationEffectReadOnly.timing")}} {{readonlyInline}}</dt>
 <dd>The {{domxref("AnimationEffectTimingReadOnly")}} object&nbsp;associated with the animation containing all the animation's timing values.</dd>
</dl>

<h3 id="Methods">Methods</h3>

<dl>
 <dt>{{domxref("KeyframeEffectReadOnly.getKeyframes()")}}&nbsp;{{readonlyInline}}</dt>
 <dd>Returns the computed keyframes that make up this effect along with their computed keyframe offsets.</dd>
 <dt>{{domxref("AnimationEffectReadOnly.getComputedTiming()")}}&nbsp;{{readonlyInline}}</dt>
 <dd>Returns the calculated, current timing values for this keyframe effect.</dd>
</dl>

<h2 id="Examples">Examples</h2>

<p>In the <a href="https://codepen.io/rachelnabors/pen/QyOqqW">Down the Rabbit Hole (with CSS Animations) example</a>, all of Alice's animations are done with CSS. CSS Animations use <code>KeyframeEffectReadOnly</code> objects, so you can't tinker with them directly with the Web Animations API. But you <em>can</em>&nbsp;inspect them like so:</p>

<pre class="brush: js">
// Have a look at the animations on Alice. 
// Her effect is a KeyframeEffectReadOnly object.
document.getElementById("alice").getAnimations()[0].effect;

// Inspect her timing object. 
document.getElementById("alice").getAnimations()[0].effect.timing;

// See what her current timing values are right now. 
// How do they differ from the above?
document.getElementById("alice").getAnimations()[0].effect.getComputedTiming();
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Web Animations', '#keyframeeffectreadonly', 'keyframeEffectReadOnly' )}}</td>
   <td>{{Spec2('Web Animations')}}</td>
   <td>Editor's draft.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<table class="compat-table" style="line-height:1.5">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a></li>
 <li>Inherits from {{domxref("AnimationEffectReadOnly")}};&nbsp;{{domxref("KeyframeEffect")}} inherits from them both.</li>
</ul>
Revert to this revision