Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Reverse easing with the animation

I'm using the Element.animate() method to animate a side panel sliding into the page when it's opened. At closing time, the animation is reversed and then plays backwards. If the easing function is asymmetric the effect looks strange because the animation plain plays backwards, including each easing step. Using "ease-out" will start opening the panel quickly and slow down towards the end. But in reverse mode, it will start slowly and end quickly. This is not like simple CSS transitions IIRC, they apply the easing forwards in any direction.

I'd rather want all animations to start more quickly than they end, no matter the visual direction or their underlying implementation. Any animation should react swiftly and then ease out towards its final state.

Unfortunately I couldn't find a way to also reverse the easing function when reversing the animation. Is that even possible?

Here's some code:

// Open the panel
let keyframes = [{ left: "-200px" }, { left: "0" }];
let options = {
    duration: 1000,   // extra slow to see the difference
    easing: "ease-out",
    fill: "forwards"
};
let animation = panel.animate(keyframes, options);

// Close the panel
animation.reverse();
// Also want to reverse the easing here, but how?

I'm using the reverse() method because the closing may also start while the opening is still ongoing (and vice versa). If somebody pushes the menu button quickly (or another app event occurs), then the new animation must begin immediately, without first cancelling the current one and resetting (jumping) the panel position to either end state. All changes in direction must be seamless (like in real world physics where things usually cannot suddenly jump, too).

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda