Created
January 28, 2017 06:12
-
-
Save slightair/6faeea81949b32ac96b2b92a00630d92 to your computer and use it in GitHub Desktop.
寿司増やして早くした #love_swift #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PlaygroundSupport | |
let view = UIView(frame: CGRect(x: 0, y:0, width:320, height:44)) | |
view.backgroundColor = UIColor.black | |
PlaygroundPage.current.liveView = view | |
(0...10).forEach { | |
let sushi = UILabel(frame: CGRect(x: 320, y: 0, width: 44, height: 44)) | |
sushi.text = "🍣" | |
view.addSubview(sushi) | |
UIView.animate(withDuration: 1, delay: TimeInterval(Double($0) / 10.0), options: [.curveLinear, .repeat], animations: { () -> Void in | |
sushi.center = CGPoint(x: 0, y: sushi.center.y) | |
}, completion: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment