Maybe, I haven't understood how the animation of the bounds property works, or the bounds property of a CALayer itself , or I am making a stupid mistake.
Here is my code: CALayer * imgLayer = [CALayer layer]; imgLayer.contents = (__bridge id) imageRef; imgLayer.delegate = nil; imgLayer.opacity = 1.0; imgLayer.anchorPoint = CGPointMake( 0.0, 0.0 ); imgLayer.zPosition = -1.0; CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath: @"bounds"]; anim.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear]; anim.duration = 5; // sec anim.autoreverses = YES; anim.repeatCount = 1000000; // = forever NSRect from_rect = NSMakeRect( 100.0, 100.0, 200.0, 200.0 ); anim.fromValue = [NSValue valueWithRect: from_rect ]; NSRect to_rect = NSMakeRect( 200.0, 200.0, 300.0, 300.0 ); anim.toValue = [NSValue valueWithRect: to_rect ]; [imgLayer addAnimation: anim forKey: @"myBoundsAnim"]; What I am seeing is that the image gets scaled (from 200 to 300 width/height) which is fine, but it always sits in the lower left corner of the screen (I am working under macOS). I want the lower left corner of the image to be animated , too. (Eventually, the animation will be a bit more complex, but for now I am just trying to understand this.) What am I missing? or going wrong? I guess I could achieve the effect by animating the position property of the layer, but I'd rather prefer to understand what is going on. I have also re-read the "Core Animation Basics" , but it doesn't explain the meaning of bounds.origin. In the drawings, it's always (0,0). Thanks a lot in advance for any insights. Best regards, Gabriel
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com