Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stop the animation while it is in progress?



Hi I have a simple image that I animate (move horizontally) on the screen from startLoc to endLoc. The animation happens when the user clicks on the Animate button (which triggers the animate action). The animation happens during 6 seconds (I set duration=6.0). There is also a Kill button (which triggers the kill action). What I want is to kill the animation while in progress. I tried to do it by setting location of the image outside screen, but it did not work. How What should I do in order stop the animation while it is in progress?


- (IBAction)animate:(id)sender
{
    position.origin.x = startLoc;
    [view setFrame:position];
    position.origin.x = endLoc;
    [NSAnimationContext beginGrouping];
    [[NSAnimationContext currentContext] setDuration:duration];
    [[view animator] setFrame:position];
    [NSAnimationContext endGrouping];
}

- (IBAction)kill:(id)sender
{
    position.origin.x = startLoc;
    [[view animator] setFrame:position];
}
@end





      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.