これは実験段階の機能です。
この機能は複数のブラウザで開発中の状態にあります。各ブラウザで用いるために、適切なベンダー接頭辞が必要な場合があります。互換性テーブルをチェックしてください。また、実験段階の機能の構文と挙動は、仕様変更に伴い各ブラウザの将来のバージョンで変更になる可能性があることに注意してください。
概要
animation-fill-mode CSS プロパティは、CSS アニメーションの適用先に対して、アニメーションの実行前や実行後にどのようなスタイルを適用するかを設定します。
| 初期値 | none |
|---|---|
| 適用対象 | 全要素、::before / ::after 疑似要素 |
| 継承 | 不可 |
| メディア | visual |
| 計算値 | 指定値 |
| アニメーションの可否 | 不可 |
| 正規順序 | 形式文法で定義される一意のあいまいでない順序 |
構文
Formal syntax: [ none | forwards | backwards | both ]#
animation-fill-mode: none
animation-fill-mode: forwards
animation-fill-mode: backwards
animation-fill-mode: both
The # indicates that several values may be given, separated by commas.
Each applies to the animation defined in the same order in animation-name.
animation-fill-mode: none, backwards
animation-fill-mode: both, forwards, none
値
none- アニメーションで指定されたスタイルは、アニメーションの実行前や実行後には適用されません。
forwards- アニメーションの適用先は、アニメーションの最後に適用されたキーフレームの指定によって計算された値を維持します。これは通常、'100%' または 'to' キーフレームになります。ただし、
animation-directionの値が 'alternate' で、かつanimation-iteration-countに偶数が設定されている場合は '0%' または 'from' キーフレームになります。animation-directionanimation-iteration-countlast keyframe encountered normaleven or odd 100%ortoreverseeven or odd 0%orfromalternateeven 0%orfromalternateodd 100%ortoalternate-reverseeven 100%ortoalternate-reverseodd 0%orfrom backwards- アニメーションの適用先に、'0%' または 'from' キーフレームで定義された値を即座に適用して、
animation-delayプロパティで指定した時間の間もその状態を維持します。animation-directionfirst relevant keyframe normaloralternate0%orfromreverseoralternate-reverse100%orto both- forwards と backwards の両方の規定に従います。よって、アニメーションの設定は実行前と実行後の両方に適用されます。
例示
h1 {
animation-fill-mode: forwards;
}
仕様
| 仕様書 | 策定状況 | コメント |
|---|---|---|
| CSS Animations Level 3 | 草案 |
ブラウザ実装状況
| 機能 | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| 基本サポート | (有)-webkit | 5.0 (5.0)-moz 16.0 (16.0) |
10 | 12-o 12.5 # |
4.0-webkit |
| 機能 | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| 基本サポート | ? | 5.0 (5.0)-moz 16.0 (16.0) |
? | ? | ? |