for _ in 0...49 {
let cardSet = UIImageView(image: UIImage(named: "cardBackLandscape"))
self.view.addSubview(cardSet)
cardSet.frame = self.landscapeCardBack.frame
self.cardSetList.append(cardSet)
}
NSNotificationCenter.defaultCenter().postNotificationName("setCreated", object: nil)
func shuffleTheSet() {
self.shuffleButton.userInteractionEnabled = false
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(0.5 * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) {
NSNotificationCenter.defaultCenter().postNotificationName("shuffleFinished", object: nil)
}
for count in 0...49 {
UIView.animateWithDuration(0.3, animations: {
let cardRotateAnimation = POPBasicAnimation(propertyNamed: kPOPLayerRotation)
cardRotateAnimation.fromValue = 0
cardRotateAnimation.toValue = CGFloat(M_PI * 2.0)
cardRotateAnimation.duration = 1
// cardRotateAnimation.duration = Double(count>5 ? count/2 : count/10)
cardRotateAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
self.cardSetList[count].layer.pop_addAnimation(cardRotateAnimation, forKey: "cardRotation")
self.cardSetList[count].frame.origin = CGPointMake(CGFloat(arc4random()) % (250 - 0 + 1) + 0, CGFloat(arc4random()) % (300 - 74 + 1) + 74)
self.view.layoutIfNeeded()
self.landscapeCardBack.removeFromSuperview()
})
}
}
for count in 0...49 {
UIView.animateWithDuration(0.3, animations: {
self.cardSetList[count].center = self.landscapeCardBack.center
})
self.view.layoutIfNeeded()
}
self.shuffleButton.userInteractionEnabled = true
self.shuffleButton.setTitle("Cut Card", forState: .Normal)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有