tags:

views:

21

answers:

0

Hi All,

Iam Flipping an image and then scaling the same flied image but, When i flip the image it work fine but when i scale the same image it gets to it's original position, (i.e) the first position from were i flip the image.

I have used following code for flipping:

float degree_angle = [[selectedLayer valueForKey:@"angle"] floatValue] * 180 / M_PI; degree_angle = 360 - (degree_angle); float radian_angle = degree_angle * M_PI / 180;

CATransform3D transform1; CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath: @"transform"]; transform1 = CATransform3DMakeRotation (radian_angle, 0, 0, 1); animation.toValue = [NSValue valueWithCATransform3D: selectedLayer.transform]; animation.removedOnCompletion = NO;

CATransform3D transform2; transform2 = CATransform3DMakeScale(-[[selectedLayer valueForKey:@"zoom"] floatValue],[[selectedLayer valueForKey:@"zoom"] floatValue],1);

CATransform3D combined = CATransform3DConcat(transform2, transform1);

selectedLayer.transform = combined;

Anyone has any idea please let me know. Thank You.