diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/css/animation-fill-mode/index.html | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/css/animation-fill-mode/index.html')
-rw-r--r-- | files/pt-br/web/css/animation-fill-mode/index.html | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/files/pt-br/web/css/animation-fill-mode/index.html b/files/pt-br/web/css/animation-fill-mode/index.html new file mode 100644 index 0000000000..8e52a69d44 --- /dev/null +++ b/files/pt-br/web/css/animation-fill-mode/index.html @@ -0,0 +1,183 @@ +--- +title: animation-fill-mode +slug: Web/CSS/animation-fill-mode +translation_of: Web/CSS/animation-fill-mode +--- +<div>{{CSSRef}}</div> + +<p>A propriedade CSS <strong><code>animation-fill-mode</code></strong> define como uma animação <a href="https://wiki.developer.mozilla.org/en/CSS">CSS</a> aplica estilos ao seu destino antes e depois de sua execução.</p> + +<div>{{EmbedInteractiveExample("pages/css/animation-fill-mode.html")}}</div> + + + +<p>It is often convenient to use the shorthand property {{cssxref("animation")}} to set all animation properties at once.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="brush: css no-line-numbers notranslate">/* Single animation */ +animation-fill-mode: none; +animation-fill-mode: forwards; +animation-fill-mode: backwards; +animation-fill-mode: both; + +/* Multiple animations */ +animation-fill-mode: none, backwards; +animation-fill-mode: both, forwards, none; +</pre> + +<h3 id="Values">Values</h3> + +<dl> + <dt><code>none</code></dt> + <dd>A animação não aplicará nenhum estilo ao destino quando não estiver em execução. Em vez disso, o elemento será exibido usando quaisquer outras regras CSS aplicadas a ele. Este é o valor padrão.</dd> + <dt><code>forwards</code></dt> + <dd>The target will retain the computed values set by the last <a href="/en-US/docs/CSS/@keyframes">keyframe</a> encountered during execution. The last keyframe depends on the value of {{cssxref("animation-direction")}} and {{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">last keyframe encountered</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>normal</code></td> + <td>even or odd</td> + <td><code>100%</code> or <code>to</code></td> + </tr> + <tr> + <td><code>reverse</code></td> + <td>even or odd</td> + <td><code>0%</code> or <code>from</code></td> + </tr> + <tr> + <td><code>alternate</code></td> + <td>even</td> + <td><code>0%</code> or <code>from</code></td> + </tr> + <tr> + <td><code>alternate</code></td> + <td>odd</td> + <td><code>100%</code> or <code>to</code></td> + </tr> + <tr> + <td><code>alternate-reverse</code></td> + <td>even</td> + <td><code>100%</code> or <code>to</code></td> + </tr> + <tr> + <td><code>alternate-reverse</code></td> + <td>odd</td> + <td><code>0%</code> or <code>from</code></td> + </tr> + </tbody> + </table> + </dd> + <dt><code>backwards</code></dt> + <dd>The animation will apply the values defined in the first relevant <a href="/en-US/docs/CSS/@keyframes">keyframe</a> as soon as it is applied to the target, and retain this during the {{cssxref("animation-delay")}} period. The first relevant keyframe depends on the value of {{cssxref("animation-direction")}}: + <table class="standard-table"> + <thead> + <tr> + <th scope="col"><code>animation-direction</code></th> + <th scope="col">first relevant keyframe</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>normal</code> or <code>alternate</code></td> + <td><code>0%</code> or <code>from</code></td> + </tr> + <tr> + <td><code>reverse</code> or <code>alternate-reverse</code></td> + <td><code>100%</code> or <code>to</code></td> + </tr> + </tbody> + </table> + </dd> + <dt><code>both</code></dt> + <dd>The animation will follow the rules for both forwards and backwards, thus extending the animation properties in both directions.</dd> +</dl> + +<div class="note"> +<p><strong>Note</strong>: When you specify multiple comma-separated values on an <code>animation-*</code> property, they will be assigned to the animations specified in the {{cssxref("animation-name")}} property in different ways depending on how many there are. For more information, see <a href="/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations#Setting_multiple_animation_property_values">Setting multiple animation property values</a>.</p> +</div> + +<h3 id="Formal_syntax">Formal syntax</h3> + +<pre class="syntaxbox notranslate">{{csssyntax}} +</pre> + +<h2 id="Example">Example</h2> + +<p>You can see the effect of <code>animation-fill-mode</code> in the following example. It demonstrates how, for an animation that runs for an infinite time, you can cause it to remain in its final state rather than reverting to the original state (which is the default).</p> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html notranslate"><p>Move your mouse over the gray box!</p> +<div class="demo"> + <div class="growsandstays">This grows and stays big.</div> + <div class="grows">This just grows.</div> +</div></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css notranslate">.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; +}</pre> + +<p>{{EmbedLiveSample('Example',700,300)}}</p> + +<p>See <a href="/en/CSS/CSS_animations">CSS animations</a> for more examples.</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSS3 Animations', '#animation-fill-mode', 'animation-fill-mode')}}</td> + <td>{{Spec2('CSS3 Animations')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<p>{{cssinfo}}</p> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("css.properties.animation-fill-mode")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations">Using CSS animations</a></li> + <li>JavaScript {{domxref("AnimationEvent")}} API</li> +</ul> |