domhofmann / PRTween

Lightweight tween library for iOS
BSD 2-Clause "Simplified" License
459 stars 63 forks source link

Cancel a running tween? #28

Open edolecki opened 11 years ago

edolecki commented 11 years ago

I've been looking @ the source and I haven't seen an obvious way to stop/kill a running tween yet. I'll keep looking but something like this should be available.

avaidyam commented 11 years ago

Simple: add an -invalidate method to the PRTweenOperation object, and in the large animation processing loop fired by the timer, check if the invalidation flag is set.

jowie commented 11 years ago

You can do [[PRTween sharedInstance] removeTweenOperation:tweenOperation]; - the only problem is that it won't remove the tween until the following loop.

I have branched the code and updated it slightly so that a tween can be invalidated instantly, with the option of sending a final block/selector with the completed value. I will create a pull request shortly.

kallipigous commented 9 years ago

Did this fork ever get published I'd really like a simple way to cancel PRTween instances.