Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
geddski

callbacks at bezier point hits?

Recommended Posts

I'd like to flip the object being animated right when it hits each point in the bezier animation. I'm aware of onUpdate but that fires every frame. Is there a way to know precisely when a bezier point is hit?

See the Pen zinsg by GreenSock (@GreenSock) on CodePen

  • Like 1
Link to comment
Share on other sites

Hi @geddski

 

Can you elaborate on this, like what you're trying to do, and what you mean by point? Beziers only go through anchor points. The objects you're animating won't go through the control points.

 

I might have a demo that does something close to what you're asking, but i don't remember if it had curves.  I'll have to check when I get home. 

 

In the meantime,  it would help if you could go into a little more detail about what you're trying to do. 

 

  • Like 1
Link to comment
Share on other sites

I actually just figured out a workaround where I calculate the proximity to the bezier points onUpdate. Thanks though OSUblake!

  • Like 1
Link to comment
Share on other sites

On 11/1/2017 at 5:55 PM, geddski said:

I actually just figured out a workaround where I calculate the proximity to the bezier points onUpdate. Thanks though OSUblake!

 

Are you sure about that? Just checking, because there's a bunch of different factors that might cause a distance check to fail:  if your object is moving too fast, browser lag, proximity to other points, and the type of Bezier you are using.

 

Don't know if you are using a "soft" type of Bezier like in the demo you posted, but it's guaranteed to only go through the first and last point. For all the other points, it's only going to go halfway. 

 

It makes more sense when you can actually see the path...

 

See the Pen vWGGGv by osublake (@osublake) on CodePen

 

 

There are ways to add a callback to a specific point on a Bezier, like splitting your Bezier up at those points, and creating separate animations for each segment. If you or anybody really wants to go that route, I can show how. 

 

  • 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.
×