LoginSignup
37
17

More than 5 years have passed since last update.

新型MacBookProのTouchBarにsushiが流れる動画を見て無性にsushiを流したくなったけど買えないので代わりにPlaygroundでsushiを流す話

Last updated at Posted at 2016-11-27

これを見て無性にsushiを流したくなったのでPlaygroundでsushiを流してみたら意外とみんな気にいってくれたので共有します。

ということで流す。※Xcode8.1

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)
}

結果こんな感じ。

みんなでPlaygroundにsushiを流そう^^/

37
17
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
37
17