From e14c7de9e3f01f965e58a2248798876bca607674 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 23 Jan 2022 02:38:04 +0900 Subject: 2021/08/13 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/animation-fill-mode/index.md | 203 ++++++++++---------------- 1 file changed, 77 insertions(+), 126 deletions(-) (limited to 'files/ja/web/css/animation-fill-mode') diff --git a/files/ja/web/css/animation-fill-mode/index.md b/files/ja/web/css/animation-fill-mode/index.md index a5fc4e219d..96cd0aea5d 100644 --- a/files/ja/web/css/animation-fill-mode/index.md +++ b/files/ja/web/css/animation-fill-mode/index.md @@ -6,21 +6,22 @@ tags: - CSS アニメーション - CSS プロパティ - リファレンス + - recipe:css-property +browser-compat: css.properties.animation-fill-mode translation_of: Web/CSS/animation-fill-mode --- -
{{CSSRef}}
+{{CSSRef}} -

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

+**`animation-fill-mode`** は [CSS](/ja/docs/Web/CSS) のプロパティで、 CSS アニメーションの実行の前後にどう対象にスタイルを適用するかを設定します。 -
{{EmbedInteractiveExample("pages/css/animation-fill-mode.html")}}
+{{EmbedInteractiveExample("pages/css/animation-fill-mode.html")}} - +アニメーションのプロパティすべてを一度に設定するには、一括指定プロパティである {{cssxref("animation")}} を使用すると便利です。 -

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

+## 構文 -

構文

- -
/* 単一のアニメーション */
+```css
+/* 単一のアニメーション */
 animation-fill-mode: none;
 animation-fill-mode: forwards;
 animation-fill-mode: backwards;
@@ -29,105 +30,71 @@ 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")}} プロパティで指定したアニメーションに割り当てられますが、いくつあるかによって異なる方法で割り当てられます。詳しくは、複数のアニメーションプロパティ値の設定 を参照してください。

-
-

形式文法

+/* グローバル値 */ +animation-fill-mode: inherit; +animation-fill-mode: initial; +animation-fill-mode: revert; +animation-fill-mode: unset; +``` + +### 値 + +- `none` + - : アニメーションが実行されていない時は、対象にスタイルを適用しません。要素は適用されているその他の CSS 規則を使用して表示されます。これが既定値です。 +- `forwards` + + - : 対象は実行の最後の[キーフレーム](/ja/docs/Web/CSS/@keyframes)で設定された計算値を保持します。最後のキーフレームは {{cssxref("animation-direction")}} と {{cssxref("animation-iteration-count")}} の値によって変わります。 + + | `animation-direction` | `animation-iteration-count` | 最後のキーフレーム | + | --------------------- | --------------------------- | ------------------ | + | `normal` | 偶数または奇数 | `100%` または `to` | + | `reverse` | 偶数または奇数 | `0%` または `from` | + | `alternate` | 偶数 | `0%` または `from` | + | `alternate` | 奇数 | `100%` または `to` | + | `alternate-reverse` | 偶数 | `100%` または `to` | + | `alternate-reverse` | 奇数 | `0%` または `from` | + +- `backwards` + + - : アニメーションは最初の適切な[キーフレーム](/ja/docs/Web/CSS/@keyframes)で定義された値を対象に適用されると同時に適用し、 {{cssxref("animation-delay")}} の期間これを保持します。最初の適切なキーフレームは、 {{cssxref("animation-direction")}} の値によって変わります。 + + | `animation-direction` | 最初の適切なキーフレーム | + | ------------------------------------ | ------------------------ | + | `normal` または `alternate` | `0%` または `from` | + | `reverse` または `alternate-reverse` | `100%` または `to` | + +- `both` + - : アニメーションは forwards と backwards の両方の既定に従います。よって、アニメーションの設定は実行前と実行後の両方に適用されます。 + +> **Note:** `animation-*` プロパティにカンマ区切りで複数の値を指定した場合、 {{cssxref("animation-name")}} プロパティで指定したアニメーションに割り当てられますが、いくつあるかによって異なる方法で割り当てられます。詳しくは、[複数のアニメーションプロパティ値の設定](/ja/docs/Web/CSS/CSS_Animations/Using_CSS_animations#setting_multiple_animation_property_values) を参照してください。 + +## 公式定義 + +{{cssinfo}} + +## 形式文法 {{csssyntax}} -

+## 例 -

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

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

HTML

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

マウスを灰色のボックスの上に乗せてください!

+
+
これは大きくなって大きいままになります。
+
これは大きくなるだけです。
+
+``` -

CSS

+### CSS -
.demo {
+```css
+.demo {
   border-top: 100px solid #ccc;
   height: 300px;
 }
@@ -146,40 +113,24 @@ animation-fill-mode: both, forwards, none;
   animation-name: grow;
   animation-duration: 3s;
   animation-fill-mode: forwards;
-}
+} +``` -

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

+### 結果 -

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

+{{EmbedLiveSample('Examples',700,300)}} -

仕様書

+これ以外の例は [CSS アニメーション](/ja/docs/Web/CSS/CSS_Animations/Using_CSS_animations)を参照してください。 - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('CSS3 Animations', '#animation-fill-mode', 'animation-fill-mode')}}{{Spec2('CSS3 Animations')}}初回定義
+## 仕様書 -

{{cssinfo}}

+{{Specifications}} -

ブラウザーの対応

+## ブラウザーの互換性 -

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

+{{Compat}} -

関連情報

+## 関連情報 - +- [CSS アニメーションの使用](/ja/docs/Web/CSS/CSS_Animations/Using_CSS_animations) +- JavaScript の {{domxref("AnimationEvent")}} API -- cgit v1.2.3-54-g00ecf