Resetting of property values after completion of a CABasicAnimation
Resetting of property values after completion of a CABasicAnimation
- Subject: Resetting of property values after completion of a CABasicAnimation
- From: Vincent Coetzee <email@hidden>
- Date: Tue, 13 Nov 2007 13:13:29 +0200
Dear List,
I am using a CABasicAnimation to fade an item out. I am setting the
opacity to 1.0 in the fromValue and to 0.0 in the toValue.The
animation works perfectly and the item fades out, however once the
animation has completed, the property (in this case opacity) seems to
get reset to the original value of 1.0 so my item sudden pops back
before I get a chance to remove it completely. I have tried everything
I can think of to stop this irritating flash to no avail. I list my
code below. Any suggestions / criticisms would be very welcome.
TIA
Vincent
- (void) fadeOut
{
CABasicAnimation *theAnimation;
ItemAnimationContext* context;
theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration=1.0;
theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
theAnimation.toValue=[NSNumber numberWithFloat:0.0];
context = [ItemAnimationContext onAnimation: theAnimation endAction:
@selector(fadeOutCompleted:) onItem: self];
[theAnimation setDelegate: context];
[[self layer] addAnimation:theAnimation forKey:@"animateOpacity"];
}
_______________________________________________
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:
This email sent to email@hidden