Join the conversation

Sign in to join this conversation, and others like it, in the communities you care about.

Frontend Hub

Talk anything related Frontend development, HTML/CSS, client side Javascript, Bootstrap, etc

Frontend Hub / General

Jumps: The New Steps() in Web Animation

Jumps: The New Steps() in Web Animation

Frontend Hub / General · March 7, 2019 at 4:02pm
This article discusses new easing options which are, as of the writing, available only in Firefox 65+. Demos will be fully realized only in Firefox until the other browsers implement this.

The first big change to web animation easings (aka timing functions) is upon us. After some discussions, updates to the specification, and initial implementations as a separate function, Firefox 65 introduces four new options for the steps() function.

  • jump-start
  • jump-end
  • jump-both
  • jump-none
https://codepen.io/danwilson/pen/gqOBJd

How do these new values compare to what we already had, and when are the best times to use each one?

Easings and the steps() function

First, let’s take a step back and discuss what easings even are and what the steps() function allows us to do.

Easings allow us to change how a transition, CSS animation, or Web Animations API animation completes over time.

.mover {
animation: move 2000ms;
animation-timing-function: linear; /* easing */
transform: translateX(0px);
}
@keyframes move {
100% {
transform: translateX(200px);
}
}

With a linear easing, everything moves at a steady pace. If we change that to ease-in we will have something that starts slower and speeds up as it gets to the end of its animation.

Steps are a bit different, as we can tell the animation to have a specific number of distinct frames. So changing the easing to steps(2), for example, would give an animation with only two states, a starting position and an ending one.

How steps() determines each step interval is based on a second (and optional) parameter. This is where our new values come into play and join the two existing values — start and end.

Read full article on https://danielcwilson.com/blog/2019/02/step-and-jump/

Load previous messages

December 7, 2022 at 3:19am

Hi Nice to meet you.

    • reply
    • like