RichardC

Bezier paths - image inverted on rotate

Recommended Posts

Hi

 

I have an image which, in this case is a fish that follows a Bezier path starting left to right and then "double backs" to the left.

 

My problem is that the image inverts to upside down on the return path. What am I doing wrong please.

 

Codepen URL attached.

 

Thanks in advance

 

RichardC

Share this post


Link to post
Share on other sites

Yeah, that's expected behavior because of the autoRotate that's applied. Imagine it going around a circular Bezier - as it gets to the right side and continues around, it'd get upside down. There are a lot of ways you could handle this, like by disabling the autoRotate and manage the rotation yourself using another tween of just the rotation property, or you could do something like this:

 

http://codepen.io/GreenSock/pen/b56eb98c7491eefe278b5909c47241b5/

 

Notice I used timelines just to make the sequencing easier, but that's not entirely necessary. I also offset the start time of them by random amounts to get a slightly scattered effect. You'd probably want to add some random variance to the x/y values too inside the loop, but that's totally up to you. Hopefully this gives you a nudge in the right direction. 

 

Docs for BezierPlugin: http://greensock.com/docs/#/HTML5/GSAP/Plugins/BezierPlugin/

  • Like 1

Share this post


Link to post
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.