
Welcome to my blog. Thanks.
Dome: github地址

- Pod pop如上篇文章
- 创建UIbutton类对象与storyboard绑定
- 应用touchesBegan ,touchesEnded
开始点击
- 缩小0.5倍
- 旋转半圈
//缩放动画
var scale = self.pop_animation(forKey: TLscale)as?POPSpringAnimation
if scale != nil {
scale?.toValue = NSValue(cgPoint:CGPoint(x: 0.5, y: 0.5))
}else{
scale = POPSpringAnimation(propertyNamed: kPOPViewScaleXY)
scale?.toValue = NSValue(cgPoint:CGPoint(x: 0.5, y: 0.5))
scale?.springBounciness = 20
scale?.springSpeed = 5
self.pop_add(scale, forKey: TLscale)
}
//旋转动画
var rotate = self.layer.pop_animation(forKey: TLrotate)as? POPSpringAnimation
if rotate != nil {
rotate?.toValue = Double.pi / 2
}else{
rotate = POPSpringAnimation(propertyNamed: kPOPLayerRotation)
rotate?.toValue = Double.pi / 2
rotate?.springBounciness = 20
rotate?.springSpeed = 18
self.layer.pop_add(rotate, forKey: TLrotate)
}
结束点击
- 缩放1.0倍回到起始状态
- 旋转到起始位置
//缩放动画
var scale = self.pop_animation(forKey: TLscale)as?POPSpringAnimation
if scale != nil {
scale?.toValue = NSValue(cgPoint:CGPoint(x: 1, y: 1))
}else{
scale = POPSpringAnimation(propertyNamed: kPOPViewScaleXY)
scale?.toValue = NSValue(cgPoint:CGPoint(x: 1, y: 1))
scale?.springBounciness = 20
scale?.springSpeed = 5
self.pop_add(scale, forKey: TLscale)
}
//旋转动画
var rotate = self.layer.pop_animation(forKey: TLrotate)as? POPSpringAnimation
if rotate != nil {
rotate?.toValue = 0
}else{
rotate = POPSpringAnimation(propertyNamed: kPOPLayerRotation)
rotate?.toValue = 0
rotate?.springBounciness = 20
rotate?.springSpeed = 18
self.layer.pop_add(rotate, forKey: TLrotate)




近期评论