This translation is incomplete. Please help translate this article from English
Este artigo aborda três ferramentas que pode utilizar para visualizar e editar animações:
Inspetor de animação
Although this tool was introduced in Firefox 41, its UI was revamped in Firefox 43. This article describes the animation inspector as it appears in Firefox 43 and subsequent releases. If you want to see what the animation inspector looks like in Firefox 41 and 42, see this separate page.
From Firefox 41, the Page Inspector includes an extra view labeled "Animations".
This view displays CSS transitions and CSS animations synchronized along a timeline, with a draggable widget you can use to move to any point in the timeline and see the page at that point.
To see how it works, we'll walk through an example. The box below contains three grayscale icons, each representing a different Firefox channel. If you click an icon, the icon enlarges and changes to color, and the name of the channel appears. Click the icon again to reverse the effect. These animations are made by applying transitions to several CSS properties.
Let's use the animation inspector to see what's going on in this example.
- Using Firefox 43 or later, right-click one of the icons and select "Inspect Element".
- You'll probably also want to adjust the selected node up a level, to the
- Switch over to the "Animations" tab.
Now play the animation:
Let's take a closer look at the contents of the animation inspector here:
It shows a synchronized timeline for every CSS property transition involved in the animation. The timeline starts at the start of the first transition, and ends at the end of the last transition, and is labeled with markers every 100 milliseconds (this depends on the time scale of the animations currently displayed). You can see that the example above takes 735 milliseconds to run.
Cada animação ou transição é mostrada como uma barra horizontal disposta através da barra cronológica:
- The bar is blue if a
transitionwas used to animate a property, and orange if a
@keyframesanimation was used.
- From Firefox 44 onwards, the bar contains a lightning bolt icon () if the property was animated using the compositor thread (see more about the cost of animating different CSS properties).
- The bar is labeled with the name of the property being animated or the name of the
- If the animation or transition had a delay, this is shown as a cross-hatched portion of the bar.
- If you hover over the bar, a tooltip appears, giving you more detailed information about the animation or transition.
To the left of each bar is a selector for the node that the animation applies to. If you hover over this selector, the node is highlighted in the page. Click the selector to select the node in the inspector.
To the left of the selector is a "target" icon (). From Firefox 44, clicking this icon will lock the highlighter on the element.
Aplicando tudo isto para o nosso exemplo, nós podemos ver que:
- The animation involved two elements,
img#selected.channel-icon. Hovering over these selectors, we can see that those elements are, respectively, the channel name "Firefox Nightly" and the channel icon:
- Each element had two properties animated:
filterproperty had a delay of 0.25 seconds applied to it.
transformproperty transition ends after 0.5 seconds.
transformproperty was animated on the compositor thread.
Reprodução de animação
No topo do inspetor de animação:
- there are buttons to play/pause and rewind the animation (new in Firefox 44)
- the current time in the animation is displayed (new in Firefox 44).
Finally, if you click inside the bar at the top of the timeline, you get a scrubber that you can drag left and right to move backwards and forwards through the animation, and pinpoint exactly what's happening when:
Editar funções de sincronização
Timing functions defined as cubic Bézier curves get an icon in the Rules view. If you click the icon you get a visual editor for the curve, enabling you to drag P1 and P2, and see the results in the page:
Esta funcionalidade utiliza o código fonte de Lea Verou’s cubic-bezier.com.
O editor cúbico Bézier inclui um número de pré-ajustes, agrupados sob "Ease-in", "Ease-out", and "Ease-in-out":