How to animate the frame of an layer with CABasicAnimation?
Posted
by mystify
on Stack Overflow
See other posts from Stack Overflow
or by mystify
Published on 2010-05-23T18:21:50Z
Indexed on
2010/05/23
18:31 UTC
Read the original article
Hit count: 231
iphone
|core-animation
I guess I have to convert the CGRect into an object to pass it to fromValue?
This is how I try it, but it doesn't work:
CABasicAnimation *frameAnimation = [CABasicAnimation animationWithKeyPath:@"frame"];
frameAnimation.duration = 2.5;
frameAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
frameAnimation.fromValue = [NSValue valueWithCGRect:myLayer.frame];
frameAnimation.toValue = [NSValue valueWithCGRect:theNewFrameRect];
[myLayer addAnimation:frameAnimation forKey:@"MLC"];
© Stack Overflow or respective owner