CSSKeyframeRule

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.

CSSKeyframeRule インターフェイスは、指定されたキーフレームのスタイルセットを表すオブジェクトを提供します。アット規則@keyframes の 1 つのキーフレームに対応しています。

CSSRule CSSKeyframeRule

インスタンスプロパティ

祖先である CSSRule からプロパティを継承しています。

CSSKeyframeRule.keyText

'10%''75%' のように、キーフレームのキーを表します。from キーワードは '0%' に対応付けられ、to キーワードは '100%' に対応づけられます。

CSSKeyframeRule.style 読取専用

キーフレームに関連した CSS スタイルの CSSStyleDeclaration を返します。

インスタンスメソッド

固有のメソッドはありません。祖先である CSSRule からメソッドを継承しています。

この CSS には、 keyframes アットルールが含まれています。これは最初の CSSRule となり、 document.styleSheets[0].cssRules で返されます。 myRules[0]CSSKeyframesRule オブジェクトを返し、その中に各キーフレームのための個別の CSSKeyFrame オブジェクトが格納されます。

css
@keyframes slidein {
  from {
    transform: translateX(0%);
  }

  to {
    transform: translateX(100%);
  }
}
js
let myRules = document.styleSheets[0].cssRules;
let keyframes = myRules[0]; // a CSSKeyframesRule
console.log(keyframes[0]); // a CSSKeyframeRule representing an individual keyframe.

仕様書

Specification
CSS Animations Level 1
# interface-csskeyframerule

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CSSKeyframeRule
keyText
style

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Requires a vendor prefix or different name for use.
Has more compatibility info.

関連情報