Swift编写的Pop动画框架的便利工具
要运行示例项目,克隆仓库,首先从示例目录运行pod install
。
import Animate
var view:UIView! = UIView(frame: CGRectMake(10, 10, 50, 50))
view.backgroundColor = UIColor.orangeColor()
self.view.addSubview(view)
view.basic { (make) -> Void in
make.backgroundColor = UIColor.grayColor()
make.center = CGPointMake(200, 200)
}.delay(1)
.spring({ (make) -> Void in
make.backgroundColor = UIColor.orangeColor()
make.center = CGPointMake(200, 300)
}).delay(1)
.decay({ (make) -> Void in
make.velocity(NSValue(CGPoint:CGPointMake(150, 150)),forProperty:kPOPViewCenter)
make.velocity(NSValue(CGRect:CGRectMake(0, 0, 200, 200)),forProperty:kPOPViewBounds)
}).delay(1)
.done { () -> Void in
view.removeFromSuperview()
view = nil
}
//or
view.spring.frame = CGRectMake(0, 0, 200, 200)
iOS 8.0或更高版本
Animate可通过CocoaPods获取。安装它,只需将以下行添加到Podfile中:
pod "Animate"
Animate可在MIT许可下使用。有关更多信息,请参阅LICENSE文件。