我正在嘗試360度旋轉(zhuǎn)視角,但傾斜度為45度.
像這樣
我無法想辦法做到這一點.
到目前為止,我已經(jīng)成功了
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];animation.fromValue = @(0);animation.toValue = @(2 * M_PI);animation.duration = 1;[self.layer addAnimation:animation forKey:@"rotation"];
它在y軸上旋轉(zhuǎn),但我想要得是這個Y軸在旋轉(zhuǎn)之前傾斜45度.
解決方法
首先,您應該看到下面得鏈接,它解釋了“框架”和“邊界”之間得差異.
UIView frame,bounds and center
UIView frame,bounds and center
現(xiàn)在,這是我得答案.
/* add the 4 lines below */self.transform = CGAffineTransformMakeRotation(M_PI_4);self.layer.bounds = CGRectMake(0.0f,0.0f,60.0f,200.0f);self.layer.position = CGPointMake(150.0f,300.0f);CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];animation.fromValue = @(0);animation.toValue = @(2 * M_PI);animation.duration = 1;[self.layer addAnimation:animation forKey:@"rotation"];
以上是來客網(wǎng)為你收集整理得iOS動畫角度旋轉(zhuǎn)全部內(nèi)容,希望內(nèi)容能夠幫你解決iOS動畫角度旋轉(zhuǎn)所遇到得程序開發(fā)問題。
如果覺得來客網(wǎng)網(wǎng)站內(nèi)容還不錯,歡迎將來客網(wǎng)網(wǎng)站推薦給程序員好友。
聲明:所有內(nèi)容來自互聯(lián)網(wǎng)搜索結(jié)果,不保證100%準確性,僅供參考。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進行處理。