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

Stop on point #2

Open
notpit opened this issue Mar 9, 2011 · 10 comments
Open

Stop on point #2

notpit opened this issue Mar 9, 2011 · 10 comments

Comments

@notpit
Copy link

notpit commented Mar 9, 2011

I'm trying to stop an object on a point or percentage of the length of a path. I was wondering if there is a feedback loop for object's current position or simpler way to do this using your plugin.

@weepy
Copy link
Owner

weepy commented Mar 9, 2011

i don't think is easy. u'll have to create a separate path :s as far as I know. unless jQuery has some new functionality to abort animations.

@notpit
Copy link
Author

notpit commented Mar 9, 2011

Well, there is the step function of the method. I've been playing around with it. Although, I haven't exactly figure it out. I think it has the potential to function this way.

However, when applying it to your plugin, the step function does not seem to return any values.

What do you mean create a separate path?

@notpit
Copy link
Author

notpit commented Mar 9, 2011

Bah.. I didn't mean to hit Comment and Close...

@weepy
Copy link
Owner

weepy commented Mar 9, 2011

could u use stop (http://api.jquery.com/stop/) within the step function perhaps ?

@notpit
Copy link
Author

notpit commented Mar 9, 2011

Well, I haven't quite figured out how to call stop() from within the step function if you even can, but you can do some neat things with it. I have some code, but I don't know how to post it in there.

On the other hand, I can't get the step function to work while using your Path plugin. Perhaps I'm missing something?

@notpit
Copy link
Author

notpit commented Mar 9, 2011

Ok, just figured out how to call stop() from step, but it doesn't work with your Paths plugin. The same data isn't being accessed when being pushed through Paths.

@notpit
Copy link
Author

notpit commented Mar 9, 2011

Check it out..
Change
var css = fx.end.css(1 - fx.pos)

to
var css = fx.end.css(fx.pos/2)

Could change the code to accept a param there maybe.

@notpit
Copy link
Author

notpit commented Mar 9, 2011

Alright, so I'm still hacking away at this. I brought the divisor in as a param, not sure that's the way to go though. Playing around with some loops now to see if I can make the divisor work...

@weepy
Copy link
Owner

weepy commented Mar 9, 2011

try

var css = fx.end.css(1 - fx.pos*param)

where param is between 0 and 1

@aquargna
Copy link

I was able to get an animation to stop at an arbitrary point along the curve by using step and stop()

$("#mover2").animate({path : new $.path.bezier(bezier_params)},
{step: function(now, fx) {
if (fx.pos > .5) {$(this).stop(true, false)}; //when the position param of fx gets bigger than .5, stop the animation
}
}

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