Swift 寫成的漢堡動畫:Icomations

jopen 10年前發布 | 9K 次閱讀 iOS開發 移動開發 Icomations

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


Swift 寫成的漢堡動畫:Icomations

項目主頁:http://www.baiduhome.net/lib/view/home/1432021723630

項目主頁:http://www.baiduhome.net/lib/view/home/1432021723630

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!