我遇到問題。如何減慢物體的旋轉?
我有這樣的代碼:
if(CGRectContainsPoint(compassTarcsa.frame, curLoc))
{
compassTarcsaTouch = YES;
float fromAngle = atan2(compassFirstLoc.y-compassTarcsa.center.y,compassFirstLoc.x-compassTarcsa.center.x);
float toAngle = atan2(curLoc.y-compassTarcsa.center.y,curLoc.x-compassTarcsa.center.x);
newAngle = (angle + (toAngle - fromAngle));
iranyFok = (newAngle/(M_PI/180.0f)) ;
if (iranyFok < 0.0f) {
iranyFok += 360.0f;
}
iranyFok = 360-(fmodf((360 + iranyFok), 360));
CGAffineTransform cgaRotate = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(- iranyFok));
compassTarcsa.transform = cgaRotate;
repcsi.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(iranyFok));
這種旋轉從0指南針到360度,但轉速快給我......
有人可以幫助我瞭解如何減緩這旋轉?
THX,
亞歷