Jump to content
Search Community

Browser crash while using the motion path plugin

dragoon test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello,

I've been trying to migrate some old animated weather codepen from TweenMax to GSAP 3 and everything works except for the Bezier animation.

I've prepared a codepen, where you can click on the wind icon, and you can see that it completely crashes the browser tab (I'm using Chrome).

In the old TweenMax code, it was animating leafs in SVG.

Would appreciate any pointers.

See the Pen XWjVxrM by rprokofyev (@rprokofyev) on CodePen

Link to comment
Share on other sites

  • Solution

Ah, I see the problem - you've got your motionPath animation using a .fromTo() and you're duplicating your starting values. You're setting the x,y at the start of the tween AND you're feeding the same values in as the start of the path Array, so MotionPathPlugin is choking on the almost-zero space between those points (I say "almost" because there's rounding applied to the x/y transforms but your Array has the raw values). In other words, it's trying to plot a path from 10,43 (for example) through 10.000001,43. 

 

The easy fix is to just omit those first values from your path Array so that you're not duplicating it with the "from" values. 

 

I've patched the next release of MotionPathPlugin to sense this condition. You can preview that at https://assets.codepen.io/16327/MotionPathPlugin.min.js

 

And here's a fork with the fix in place:

See the Pen 91fe851d0ed67e59ed394249985239aa?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Does that clear things up? 

 

Oh, and I'd recommend using the string-based eases instead of stuff like Power2 (it's just "power2" as a string). And Power0 could be replaced with "none" or "linear". 

 

Happy tweening!

  • Like 3
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...