Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flicker when animating translateX #269

Closed
jlongster opened this issue Oct 26, 2017 · 2 comments
Closed

Flicker when animating translateX #269

jlongster opened this issue Oct 26, 2017 · 2 comments

Comments

@jlongster
Copy link

I'm in latest Chrome, and this is what I see when I try to animate translateX: http://jlongster.com/s/flicker-anime.mov

This is the code I'm using to animate it, very simple:

  const elements = [];
  let x = 0;

  function animateLeft() {
    x -= 250;
    anime({
      targets: elements,
      translateX: x
    });
  }

  function animateRight() {
    x += 250;
    anime({
      targets: elements,
      translateX: x
    });
  }

There are buttons off screen that I'm pressing to move it back and forth. Any idea?

@juliangarnier
Copy link
Owner

I'm in latest Chrome, and this is what I see when I try to animate translateX: http://jlongster.com/s/flicker-anime.mov

You have to make sure the elements translateX values are not animated when creating a new animation, like this:

  const elements = [];
  let x = 0;

  function animateLeft() {
    anime.remove(elements);
    x -= 250;
    anime({
      targets: elements,
      translateX: x
    });
  }

  function animateRight() {
    anime.remove(elements);
    x += 250;
    anime({
      targets: elements,
      translateX: x
    });
  }

@garrettmaring
Copy link

When using 2.2.0, this actually made the difference between a flicker and not for me. remove seems to be pretty important when re-running animations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants