Jump to content
Search Community

Adding onUpdate function fixes animation?

iDVB test
Moderator Tag

Recommended Posts

Here is a very weird one.

We have an animation that seems to break when the browser is resized.

Only a single circle of the 6 we loop thru to create the animation breaks.

 

Here's the kicker. The fix was to simply add an EMPTY `onUpdate` function:

  const explosionMovementAmount = Math.min(windowWidth, windowHeight) * 0.28;
  const explosionAngle = MathUtils.degToRad(60);
  metaballs.forEach((metaball, i) => {
    explosionTl.fromTo(
      metaball.position,
      { x: () => metaballTarget.x, y: () => metaballTarget.y },
      {
        x: () =>
          explosionMovementAmount * Math.sin(i * explosionAngle) +
          metaballTarget.x,
        y: () =>
          explosionMovementAmount * Math.cos(i * explosionAngle) +
          metaballTarget.y,
        immediateRender: false,
        onUpdate: function () {},
        ease: 'back.inOut',
        duration: 2,
        yoyo: true,
        repeat: 1,
        repeatDelay: 1,
      },
      1
    );
  });

Just simply adding that fixes the issue.

 

Here is what is looks like broken: 

 

And here is with the empty onUpdate that fixes things:

 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...