Skip to content

NSTimer continues running after all tweens have completed #35

@jowie

Description

@jowie

I have tweaked my local copy so that it invalidates the timer once all tweens have finished, and creates a new timer if needed at the top of addTweenOperation: instead. I believe this is better for large projects such as mine, as it cuts down on the number of instructions happening every second:

- (PRTweenOperation*)addTweenOperation:(PRTweenOperation*)operation
{
    if (timer == nil)
    {
        timer = [NSTimer scheduledTimerWithTimeInterval:kPRTweenFramerate target:self selector:@selector(update) userInfo:nil repeats:YES];
    }
...

And again at the bottom of the update method:

...
    if(tweenOperations.count == 0)
    {
        [timer invalidate];
        timer = nil;
    }
}

Let me know if I can pull this and add the code, I would be happy to!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions