Hi everyone,

I've been struggling to work out how to animate some properties on my NSButton subclass. I have looked through all the examples given in Apple's docs, but can't work out why my code doesn't animate.

My code is:
        [CATransaction begin]; // Begin grouping animated property changes
        
        if (highlightEffect == SGUIButtonOpaqueEffect) {
                
                [CATransaction begin];
                [CATransaction setValue:[NSNumber numberWithFloat:5.0f]
                                                 
forKey:kCATransactionAnimationDuration];
                self.layer.opacity = 1.0;
                [CATransaction commit];
                
        } else if (highlightEffect == SGUIButtonSlideEffect) {
                
                [CATransaction begin];
                [CATransaction setValue:[NSNumber numberWithFloat:1.0f]
                                                 
forKey:kCATransactionAnimationDuration];
self.layer.bounds = CGRectMake(self.layer.position.x, self.layer.position.y, self.bounds.size.width + 10, self.bounds.size.height);
                [CATransaction commit];
                
                [CATransaction begin];
                [CATransaction setValue:[NSNumber numberWithFloat:2.0f]
                                                 
forKey:kCATransactionAnimationDuration];
self.layer.position = CGPointMake(self.layer.position.x - self.layer.bounds.size.width, self.layer.position.y);
                [CATransaction commit];
                
        }
        
        [CATransaction commit];

Can anyone see any problems with this? Why aren't there any animations when this code executes?

Any help greatly appreciated.

Adam Radestock
Glass Monkey Software
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to