aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/css/transition-timing-function/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-br/web/css/transition-timing-function/index.html')
-rw-r--r--files/pt-br/web/css/transition-timing-function/index.html666
1 files changed, 666 insertions, 0 deletions
diff --git a/files/pt-br/web/css/transition-timing-function/index.html b/files/pt-br/web/css/transition-timing-function/index.html
new file mode 100644
index 0000000000..f352392102
--- /dev/null
+++ b/files/pt-br/web/css/transition-timing-function/index.html
@@ -0,0 +1,666 @@
+---
+title: transition-timing-function
+slug: Web/CSS/transition-timing-function
+translation_of: Web/CSS/transition-timing-function
+---
+<div>{{CSSRef}}</div>
+
+<p>A propriedade CSS <strong><code>transition-timing-function</code></strong> é usada para descrever como os valores intermediários das propriedades CSS sendo afetados por um efeito de transição são calculados. Em essência isso permite você estabelecer uma curva de aceleração, para que então a velocidade da transição possa variar durante sua duração.</p>
+
+<p>Essa curva de aceleração é definida usando {{cssxref("&lt;timing-function&gt;")}} para cada propriedade a ser transicionada.</p>
+
+<pre class="brush:css no-line-numbers">/* Keyword values */
+transition-timing-function: ease;
+transition-timing-function: ease-in;
+transition-timing-function: ease-out;
+transition-timing-function: ease-in-out;
+transition-timing-function: linear;
+transition-timing-function: step-start;
+transition-timing-function: step-end;
+
+/* Function values */
+transition-timing-function: steps(4, end);
+transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
+transition-timing-function: frames(10);
+
+/* Multiple timing functions */
+transition-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1);
+
+/* Global values */
+transition-timing-function: inherit;
+transition-timing-function: initial;
+transition-timing-function: unset;
+</pre>
+
+<p>You may specify multiple timing functions; each one will be applied to the corresponding property as specified by the {{ cssxref("transition-property") }} property, which acts as a master list. If there are fewer functions specified than in the master list, missing values are set to the initial value (<code>ease</code>). If there are more timing functions, the list is simply truncated to the right size. In both case the CSS declaration stays valid.</p>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<h3 id="Values">Values</h3>
+
+<dl>
+ <dt><code>&lt;timing-function&gt;</code></dt>
+ <dd>Each {{cssxref("&lt;timing-function&gt;")}} represents the timing function to link to the corresponding property to transition, as defined in {{ cssxref("transition-property") }}.</dd>
+</dl>
+
+<h3 id="Formal_syntax">Formal syntax</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Examples">Examples</h2>
+
+<div>
+<div id="ttf_ease" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: ease</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_ease",275,150)}}</div>
+</div>
+
+<div id="ttf_easein" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: ease-in</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease-in;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease-in;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease-in;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease-in;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_easein",275,150)}}</div>
+</div>
+
+<div id="ttf_easeout" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: ease-out</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease-out;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease-out;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease-out;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease-out;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_easeout",275,150)}}</div>
+</div>
+
+<div id="ttf_easeinout" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: ease-in-out</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease-in-out;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease-in-out;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: ease-in-out;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: ease-in-out;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_easeinout",275,150)}}</div>
+</div>
+</div>
+
+<div id="ttf_linear" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: linear</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: linear;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: linear;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: linear;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: linear;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_linear",275,150)}}</div>
+</div>
+
+<div id="ttf_stepstart" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: step-start</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: step-start;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: step-start;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: step-start;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: step-start;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_stepstart",275,150)}}</div>
+</div>
+
+<div id="ttf_stepend" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: step-end</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: step-end;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: step-end;
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: step-end;
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: step-end;
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_stepend",275,150)}}</div>
+</div>
+
+<div id="ttf_step4end" style="width: 251px; display: inline-block; margin-right: 1px; margin-bottom: 1px;">
+<p><code>transition-timing-function: steps(4, end)</code></p>
+
+<div style="display: none;">
+<pre class="brush:html"> &lt;div class="parent"&gt;
+ &lt;div class="box"&gt;Lorem&lt;/div&gt;
+&lt;/div&gt;
+ </pre>
+
+<pre class="brush:css;">.parent { width: 250px; height:125px;}
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ font-size: 20px;
+ left: 0px;
+ top: 0px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: steps(4, end);
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: steps(4, end);
+}
+.box1{
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ color: yellow;
+ font-size: 18px;
+ left: 150px;
+ top:25px;
+ position:absolute;
+ -webkit-transition-property: width height background-color font-size left top color;
+ -webkit-transition-duration:2s;
+ -webkit-transition-timing-function: steps(4, end);
+ transition-property: width height background-color font-size left top color;
+ transition-duration:2s;
+ transition-timing-function: steps(4, end);
+}
+</pre>
+
+<pre class="brush:js">function updateTransition() {
+ var el = document.querySelector("div.box");
+
+ if (el) {
+ el.className = "box1";
+ } else {
+ el = document.querySelector("div.box1");
+ el.className = "box";
+ }
+
+ return el;
+}
+
+var intervalID = window.setInterval(updateTransition, 7000);
+</pre>
+</div>
+
+<div>{{EmbedLiveSample("ttf_step4end",275,150)}}</div>
+</div>
+
+<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 Transitions', '#transition-timing-function-property', 'transition-timing-function') }}</td>
+ <td>{{ Spec2('CSS3 Transitions') }}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>26</td>
+ <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}<br>
+ {{CompatVersionUnknown}}</td>
+ <td>{{ CompatGeckoDesktop("2.0") }}{{ property_prefix("-moz") }}<br>
+ {{ CompatGeckoDesktop("16.0") }}<sup>[1]</sup></td>
+ <td>10</td>
+ <td>11.6{{ property_prefix("-o") }}<br>
+ 12.10 <a href="http://my.opera.com/ODIN/blog/2012/08/03/a-hot-opera-12-50-summer-time-snapshot" title="http://my.opera.com/ODIN/blog/2012/08/03/a-hot-opera-12-50-summer-time-snapshot">#</a></td>
+ <td>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td>
+ </tr>
+ <tr>
+ <td><code>frames()</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("55.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td>
+ <td>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td>
+ <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}<br>
+ {{CompatVersionUnknown}}</td>
+ <td>{{ CompatGeckoMobile("2.0") }}{{ property_prefix("-moz") }}<br>
+ {{ CompatGeckoMobile("16.0") }}<sup>[1]</sup></td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td>
+ </tr>
+ <tr>
+ <td><code>frames()</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{ CompatGeckoMobile("55.0") }}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] In addition to the unprefixed support, Gecko 44.0 {{geckoRelease("44.0")}} added support for a <code>-webkit</code> prefixed version of the property for web compatibility reasons behind the preference <code>layout.css.prefixes.webkit</code>, defaulting to <code>false</code>. Since Gecko 49.0 {{geckoRelease("49.0")}} the preference defaults to <code>true</code>.</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/CSS/Using_CSS_transitions" title="en/CSS/CSS transitions">Using CSS transitions</a></li>
+ <li>{{ domxref("TransitionEvent") }}</li>
+</ul>