Skip to content

Instantly share code, notes, and snippets.

@jollyjoester
Created January 28, 2017 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jollyjoester/44717aaca26ed0b005fd946314ce0146 to your computer and use it in GitHub Desktop.
Save jollyjoester/44717aaca26ed0b005fd946314ce0146 to your computer and use it in GitHub Desktop.
すしを流す #love_swift #CodePiece
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...2).forEach {
let sushi = UILabel(frame: CGRect(x: 320, y: 0, width: 44, height: 44))
sushi.text = "🍣"
view.addSubview(sushi)
UIView.animate(withDuration: 3, delay: TimeInterval($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