views:

21

answers:

0

Hi i have change the frame size using CABasicAnimation i used below code

CABasicAnimation *newanim; newanim = [CABasicAnimation animationWithKeyPath:@"bounds.size"];

newanim.duration=3.0;
newanim.fromValue=[NSValue valueWithCGSize:CGSizeMake(0,0)];
newanim.toValue=[NSValue valueWithCGSize:CGSizeMake(self.backgroundImageView.bounds.size.width, self.foregroundImageView.bounds.size.height)];


newanim.fillMode=kCAFillModeForwards;
newanim.autoreverses = YES;
newanim.repeatCount = 1;
newanim.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
[self.view.layer addAnimation:newanim forKey:@"changeSize"]; 

But the animation starts for origin and moves both side(like animation starts from center).

i tried by changing newanim = [CABasicAnimation animationWithKeyPath:@"frame.size"];

it not work at all.