elementary CAAnimationGroup question
elementary CAAnimationGroup question
- Subject: elementary CAAnimationGroup question
- From: Matt Neuburg <email@hidden>
- Date: Sat, 31 Jan 2009 15:19:32 -0800
- Thread-topic: elementary CAAnimationGroup question
Just as an experiment, learning about Core Animation, I tried using the
implicit animator proxy to make a picture (an image well, "iw") drop and
tumble to the bottom of the window. So I want it to move ("frameOrigin") and
turn over ("frameRotation") simultaneously. To do that, I tried making an
animation group:
NSPoint p = iw.frame.origin;
CABasicAnimation* anim1 = [CABasicAnimation
animationWithKeyPath:@"frameOrigin"];
p.y = iw.frame.size.height;
p.x += iw.frame.size.width;
anim1.toValue = [NSValue valueWithPoint: p];
CABasicAnimation* anim2 = [CABasicAnimation
animationWithKeyPath:@"frameRotation"];
anim2.fromValue = [NSNumber numberWithFloat: 0.0f];
anim2.toValue = [NSNumber numberWithFloat: 180.0f];
CAAnimationGroup* g = [CAAnimationGroup animation];
g.animations = [NSArray arrayWithObjects: anim1, anim2, nil];
g.duration = 3.0;
[iw setAnimations:[NSDictionary dictionaryWithObject:g
forKey:@"frameOrigin"]];
[[iw animator] setFrameOrigin: p];
It works okay. But here's my question. When I give the window contentView a
layer (with setWantsLayer:YES or with the checkbox in the nib), it stops
working - the rotation never happens and the duration is ignored. Why? Is it
because I'm doing this wrong, and it was just dumb luck that it ever worked
in the first place? Why would the existence of the layer make a difference?
And what's the right way to do this when there is a layer? Thx - m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, http://tinyurl.com/2ouo3b
Take Control of Customizing Leopard, http://tinyurl.com/2t9629
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
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