Swift 写成的汉堡动画:Icomations
jopen
10年前
Icomations 是用 Swift 写成的汉堡动画。
Import Icomation.swift in your project. Add a button to your view via Interface Builder, change the class to Icomation in the Identity Inspector and connect an outlet to it. Or create a new Icomation in code
var icomation = Icomation(frame: CGRectMake(0, 0, 50, 50)) view.addSubview(icomation)
Set a type
icomation.type = IconType.ArrowUp
Choose a color for each segment (default is white)
icomation.topShape.strokeColor = UIColor.redColor().CGColor icomation.middleShape.strokeColor = UIColor.blueColor().CGColor icomation.bottomShape.strokeColor = UIColor.blackColor().CGColor
Set a duration for the animation
icomation.animationDuration = 1.0
Set the number of rotations for the animation
icomation.numberOfRotations = 3