1

It feels simple really. I have an UIImageView:

start

and I want to apply an affine transform to get this image:

end

However, the particular transform in question eludes me. Rotating by 180° gets me this:

transform = CGAffineTransformMakeRotation(M_PI);
// similarly, CGAffineTransformMakeScale(-1, -1);

rotate

which is oviously quite far off. Translation is also problematic:

transform = CGAffineTransformMakeTranslation(x, y);

translate

Reflecting over the line y = x and then rotating 180° gets me this:

transform = CGAffineTransformMake(0, 1, 1, 0, 0, 0);
transform = CGAffineTransformRotate(M_PI);

reflect-rotate

which is closer, but still not there. Is there something obvious that I'm missing, or is this really complicated? Does anyone know what sort of transform I'm looking for here?

Edit:

Twitter feedback is suggesting that affine transforms aren't the way to go. At the end of the day, I simply want the resultant image, so any suggested routes to success are greatly appreciated!

1 Answer 1

1

You are trying to move a sprite, whether you realize it or not. No transformation can move the star and keep the background. Your options are to: - make a large background and clip it at the end, so that translation works - make a sprite image on top of a separate background image. If you're using iOS7, you may want to use the Sprite Kit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.