簡體   English   中英

curve動畫旋轉方向?

[英]curve Animation direction of rotation?

在我的應用程序中,我使用以下動畫使UIElement沿順時針方向沿着圓路徑移動

CGMutablePathRef path = CGPathCreateMutable(); 
CGPathAddArc(path, NULL,viewFormsUI.center.x,viewFormsUI.center.y, 
                     88,radianOf(243),radianOf(0), YES); //viewFormsUI is an UIView 
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 
[animation setPath:path]; 
[animation setDuration:1];
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeForwards; 
[animation setAutoreverses:NO];
CFRelease(path); 
[btnRefreshUI.layer addAnimation:animation forKey:@"curveAnimation"];
                             //btnRefreshUI is an UIButton

radianOf是將角度轉換為弧度的函數(只需返回M_PI *(angle / 180)的值)

但是問題是UIElement沿逆時針方向旋轉。 我找不到我的代碼中的錯誤,請幫幫我。

CGPathAddArc(path,NULL,viewFormsUI.center.x,viewFormsUI.center.y,88,radianOf(243),radianOf(0), YES );

嘗試將YES更改為NO

CGPathAddArc(path,NULL,viewFormsUI.center.x,viewFormsUI.center.y,88,radianOf(243),radianOf(0), NO );

這是-順時針布爾

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM