Wandering CGAffineTransformMakeRotation
Posted
by Joe
on Stack Overflow
See other posts from Stack Overflow
or by Joe
Published on 2010-04-29T04:05:40Z
Indexed on
2010/04/29
4:17 UTC
Read the original article
Hit count: 607
objective-c
Okay this is about to make me insane -- any help would be appreciated. I have two images which are part of a timer application. One is the needle/hand and the other is a little hub which is styled to look like the needle base. I'm using a CGAffineTransformMakeRotation to rotate the needle and the base stays stationary. The problem: there is like a 1-2px 'wander' to the needle's rotation which makes it look like it's moving off center in relation to the base. I have worked the base and needle image over in PS extensively, and both are dead center pixel wise -- seriously. My method to rotate the hand:
-(IBAction) rotateSteamArrow{
CGAffineTransform rotate = CGAffineTransformMakeRotation( degreesSteam / 180.0 * 3.14159265);
degreesSteam = degreesSteam + 1.5;
if (degreesSteam <= 180) {
[steamNeedle setTransform:rotate];
}
else {
[self handleSteamTimer];
[self toggleButton:(id)timerButton];
[self switchSound];
}
}
© Stack Overflow or respective owner