我试图让图像视图在360和720之间旋转随机度。所以我想要图像视图旋转一次(360度),然后再次旋转随机度(0到360)旋转图像查看随机
func rotateRandom2(){
let lower : UInt32 = 360
let upper : UInt32 = 720
let diceRoll = CGFloat(arc4random_uniform(upper - lower) + lower)
let degree = 0.0174532925 as CGFloat
let rotate = diceRoll
UIView.animateWithDuration(1, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut, animations: {() -> Void in
self.bottleImageView.transform = CGAffineTransformRotate(self.bottleImageView.transform, rotate)
}, completion: nil)
}
第一:值应该是弧度,这意味着0 - 2PI而不是0 - 360秒:您可能需要使用CABasicAnimation和指定它是一种添加剂动画。 – luk2302
@ luk2302 - 我不知道该怎么做(?) –
http://stackoverflow.com/questions/17426802/using-cabasicanimation-to-rotate-a-uiimageview-more-than-once – luk2302