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.
What sort of transform would give me the desired resultant image?
-
02-06-2022 - |
Pergunta
It feels simple really. I have an UIImageView:
and I want to apply an affine transform to get this image:
However, the particular transform in question eludes me. Rotating by 180° gets me this:
transform = CGAffineTransformMakeRotation(M_PI);
// similarly, CGAffineTransformMakeScale(-1, -1);
which is oviously quite far off. Translation is also problematic:
transform = CGAffineTransformMakeTranslation(x, y);
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);
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!
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow