Problem with CAAnimation in a screensaver
Problem with CAAnimation in a screensaver
- Subject: Problem with CAAnimation in a screensaver
- From: Gabriel Zachmann <email@hidden>
- Date: Thu, 29 Sep 2016 01:01:17 +0200
In my screensaver, I use layers and explicit animations to animate the bounds (size) of the layer.
At some point, I'd like to pause the animation.
I am trying to do that by setting the duration of the animation to a very large value.
The effect is that the layer still changes its bounds , i.e., it grows and shrinks --
however, the screensaver's animateOneFrame() function does not get called any more.
(Code snippets below)
Any ideas why that is?
All insights and hints will be appreciated.
Best regards,
Gabriel.
Code snippets:
This is how I create and set the animation:
CALayer * imgLayer = [CALayer layer];
...
CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath: @"bounds.size"];
anim.duration = 30.0;
...
[imgLayer addAnimation: anim forKey: @"myBoundsAnim"];
CABasicAnimation * fadein = [CABasicAnimation animationWithKeyPath: @"opacity"];
...
[imgLayer addAnimation: fadein forKey: nil];
[mainLayer_ addSublayer: imgLayer];
currentLayer_ = imgLayer; // this is an ivar
This is how I am trying to pause the zooming animation in the -animateOneFrame method of the screensaver:
CAAnimation * zoominganim = [ currentLayer_ animationForKey: @"myBoundsAnim" ];
zoominganim.duration = 1e100;
_______________________________________________
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