From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/css/animation-fill-mode/index.html | 187 ++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 files/ja/web/css/animation-fill-mode/index.html (limited to 'files/ja/web/css/animation-fill-mode') diff --git a/files/ja/web/css/animation-fill-mode/index.html b/files/ja/web/css/animation-fill-mode/index.html new file mode 100644 index 0000000000..d2752a3009 --- /dev/null +++ b/files/ja/web/css/animation-fill-mode/index.html @@ -0,0 +1,187 @@ +--- +title: animation-fill-mode +slug: Web/CSS/animation-fill-mode +tags: + - CSS + - CSS アニメーション + - CSS プロパティ + - リファレンス +translation_of: Web/CSS/animation-fill-mode +--- +
{{CSSRef}}
+ +

CSSanimation-fill-mode プロパティは、 CSS アニメーションの実行の前後にどう対象にスタイルを適用するかを設定します。

+ +
{{EmbedInteractiveExample("pages/css/animation-fill-mode.html")}}
+ + + +

アニメーションのプロパティすべてを一度に設定するには、一括指定プロパティである {{cssxref("animation")}} を使用すると便利です。

+ +

構文

+ +
/* 単一のアニメーション */
+animation-fill-mode: none;
+animation-fill-mode: forwards;
+animation-fill-mode: backwards;
+animation-fill-mode: both;
+
+/* 複数のアニメーション */
+animation-fill-mode: none, backwards;
+animation-fill-mode: both, forwards, none;
+
+ +

+ +
+
none
+
アニメーションが実行されていない時は、対象にスタイルを適用しません。要素は適用されているその他の CSS 規則を使用して表示されます。これが既定値です。
+
forwards
+
対象は実行の最後のキーフレームで設定された計算値を保持します。最後のキーフレームは {{cssxref("animation-direction")}} と {{cssxref("animation-iteration-count")}} の値によって変わります。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
animation-directionanimation-iteration-count最後のキーフレーム
normal偶数または奇数100% または to
reverse偶数または奇数0% または from
alternate偶数0% または from
alternate奇数100% または to
alternate-reverse偶数100% または to
alternate-reverse奇数0% または from
+
+
backwards
+
アニメーションは最初の適切なキーフレームで定義された値を対象に適用されると同時に適用し、 {{cssxref("animation-delay")}} の期間これを保持します。最初の適切なキーフレームは、 {{cssxref("animation-direction")}} の値によって変わります。 + + + + + + + + + + + + + + + + + +
animation-direction最初の適切なキーフレーム
normal または alternate0% または from
reverse または alternate-reverse100% または to
+
+
both
+
アニメーションは forwards と backwards の両方の既定に従います。よって、アニメーションの設定は実行前と実行後の両方に適用されます。
+
+ +
+

メモ: animation-* プロパティにコンマ区切りで複数の値を指定した場合、 {{cssxref("animation-name")}} プロパティで指定したアニメーションに割り当てられますが、いくつあるかによって異なる方法で割り当てられます。詳しくは、複数のアニメーションプロパティ値の設定 を参照してください。

+
+ +

形式文法

+ +
{{csssyntax}}
+ +

+ +

以下の例で animation-fill-mode の効果を見ることができます。これは無限に繰り返されるアニメーションが、元の状態に戻るのではなく最後の状態を維持するようにすることができます(既定の状態)。

+ +

HTML

+ +
<p>マウスを灰色のボックスの上に乗せてください!</p>
+<div class="demo">
+ <div class="growsandstays">これは大きくなって大きいままになります。</div>
+  <div class="grows">これは大きくなるだけです。</div>
+</div>
+ +

CSS

+ +
.demo {
+  border-top: 100px solid #ccc;
+  height: 300px;
+}
+
+@keyframes grow {
+  0% { font-size: 0; }
+  100% { font-size: 40px; }
+}
+
+.demo:hover .grows {
+  animation-name: grow;
+  animation-duration: 3s;
+}
+
+.demo:hover .growsandstays {
+  animation-name: grow;
+  animation-duration: 3s;
+  animation-fill-mode: forwards;
+}
+ +

{{EmbedLiveSample('Example',700,300)}}

+ +

これ以外の例は CSS アニメーションを参照してください。

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('CSS3 Animations', '#animation-fill-mode', 'animation-fill-mode')}}{{Spec2('CSS3 Animations')}}初回定義
+ +

{{cssinfo}}

+ +

ブラウザーの対応

+ + + +

{{Compat("css.properties.animation-fill-mode")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf