aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/css/animation-fill-mode/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/web/css/animation-fill-mode/index.md')
-rw-r--r--files/fr/web/css/animation-fill-mode/index.md185
1 files changed, 185 insertions, 0 deletions
diff --git a/files/fr/web/css/animation-fill-mode/index.md b/files/fr/web/css/animation-fill-mode/index.md
new file mode 100644
index 0000000000..01b33f2513
--- /dev/null
+++ b/files/fr/web/css/animation-fill-mode/index.md
@@ -0,0 +1,185 @@
+---
+title: animation-fill-mode
+slug: Web/CSS/animation-fill-mode
+tags:
+ - CSS
+ - Propriété
+ - Reference
+translation_of: Web/CSS/animation-fill-mode
+---
+<div>{{CSSRef}}</div>
+
+<p>La propriété <strong><code>animation-fill-mode</code></strong> indique la façon dont une animation CSS doit appliquer les styles à sa cible avant et après son exécution.</p>
+
+<div>{{EmbedInteractiveExample("pages/css/animation-fill-mode.html")}}</div>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="brush: css no-line-numbers">/* Valeurs avec un mot-clé */
+animation-fill-mode: none;
+animation-fill-mode: forwards;
+animation-fill-mode: backwards;
+animation-fill-mode: both;
+
+/* Gestion de plusieurs animations */
+animation-fill-mode: none, backwards;
+animation-fill-mode: both, forwards, none;
+</pre>
+
+<h3 id="Valeurs">Valeurs</h3>
+
+<dl>
+ <dt><code>none</code></dt>
+ <dd>L'animation n'appliquera aucun style à la cible, avant et après l'exécution. Le style utilisé sera celui défini par les autres règles CSS.</dd>
+ <dt><code>forwards</code></dt>
+ <dd>La cible retiendra les valeurs calculées définies lors de la dernière étape (<em>keyframe</em>). La dernière étape considérée dépend de la valeur de {{cssxref("animation-direction")}} et de {{cssxref("animation-iteration-count")}} :
+ <table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col"><code>animation-direction</code></th>
+ <th scope="col"><code>animation-iteration-count</code></th>
+ <th scope="col">dernière <em>keyframe</em></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>normal</code></td>
+ <td>pair ou impair</td>
+ <td><code>100%</code> ou <code>to</code></td>
+ </tr>
+ <tr>
+ <td><code>reverse</code></td>
+ <td>pair ou impair</td>
+ <td><code>0%</code> ou <code>from</code></td>
+ </tr>
+ <tr>
+ <td><code>alternate</code></td>
+ <td>pair</td>
+ <td><code>0%</code> ou <code>from</code></td>
+ </tr>
+ <tr>
+ <td><code>alternate</code></td>
+ <td>impair</td>
+ <td><code>100%</code> ou <code>to</code></td>
+ </tr>
+ <tr>
+ <td><code>alternate-reverse</code></td>
+ <td>pair</td>
+ <td><code>100%</code> ou <code>to</code></td>
+ </tr>
+ <tr>
+ <td><code>alternate-reverse</code></td>
+ <td>impair</td>
+ <td><code>0%</code> ou <code>from</code></td>
+ </tr>
+ </tbody>
+ </table>
+ </dd>
+ <dt><code>backwards</code></dt>
+ <dd>L'animation appliquera les valeur définies par la première <em>keyframe</em> pertinente et les retiendra pendant la durée indiquée par {{cssxref("animation-delay")}}. La première <em>keyframe</em> pertinente dépend de la valeur de {{cssxref("animation-direction")}} :
+ <table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col"><code>animation-direction</code></th>
+ <th scope="col">première <em>keyframe</em></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>normal</code> ou <code>alternate</code></td>
+ <td><code>0%</code> ou <code>from</code></td>
+ </tr>
+ <tr>
+ <td><code>reverse</code> ou <code>alternate-reverse</code></td>
+ <td><code>100%</code> ou <code>to</code></td>
+ </tr>
+ </tbody>
+ </table>
+ </dd>
+ <dt><code>both</code></dt>
+ <dd>L'animation respectera les règles qui s'appliquent à <code>forwards</code> et <code>backwards</code>, entraînant ainsi l'extension des propriétés de l'animation dans les deux directions.</dd>
+</dl>
+
+<div class="note">
+<p><strong>Note :</strong> Lorsqu'on utiliser plusieurs valeurs, séparées par des virgules, pour une propriété <code>animation-*</code>, selon leur quantité, elles seront différemment affectées aux animations définies par {{cssxref("animation-name")}}. Pour plus d'informations, voir : paramétrer <a href="/fr/docs/Web/CSS/Animations_CSS/Utiliser_les_animations_CSS">les valeurs des propriétés pour plusieurs animations</a>.</p>
+</div>
+
+<h3 id="Syntaxe_formelle">Syntaxe formelle</h3>
+
+{{csssyntax}}
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css">.demo {
+ border-top: 100px solid #ccc;
+ height: 300px;
+ font-family: sans-serif;
+}
+@keyframes grow {
+ 0% { font-size: 0 }
+ 100% { font-size: 40px }
+}
+@-webkit-keyframes grow {
+ 0% { font-size: 0 }
+ 100% { font-size: 40px }
+}
+.demo:hover .grows {
+ animation-name: grow;
+ animation-duration: 3s;
+ -webkit-animation-name: grow;
+ -webkit-animation-duration: 3s;
+}
+.demo:hover .growsandstays {
+ animation-name: grow;
+ animation-duration: 3s;
+ animation-fill-mode: forwards;
+ -webkit-animation-name: grow;
+ -webkit-animation-duration: 3s;
+ -webkit-animation-fill-mode: forwards;
+}</pre>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;p&gt;Déplacez votre souris sur la boîte grise.&lt;/p&gt;
+&lt;div class="demo"&gt;
+ &lt;div class="growsandstays"&gt;La boîte grandit et s'arrête&lt;/div&gt;
+ &lt;div class="grows"&gt;La boîte grandit&lt;/div&gt;
+&lt;/div&gt;</pre>
+
+<h3 id="Résultat">Résultat</h3>
+
+<p>{{EmbedLiveSample('Exemples',700,300)}}</p>
+
+<h2 id="Spécifications">Spécifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Spécification</th>
+ <th scope="col">État</th>
+ <th scope="col">Commentaires</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS3 Animations', '#animation-fill-mode', 'animation-fill-mode')}}</td>
+ <td>{{Spec2('CSS3 Animations')}}</td>
+ <td>Définition initiale.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
+
+<p>{{Compat("css.properties.animation-fill-mode")}}</p>
+
+<h2 id="Voir_aussi">Voir aussi</h2>
+
+<ul>
+ <li><a href="/fr/docs/Web/CSS/CSS_Animations/Utiliser_les_animations_CSS">Manipuler les animations CSS</a></li>
+ <li>{{domxref("AnimationEvent", "AnimationEvent")}}</li>
+</ul>