Skip to content

Commit

Permalink
コメント追加
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshi oshiro committed Dec 3, 2018
1 parent 4e15d67 commit 8f53d00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Binary file not shown.
12 changes: 6 additions & 6 deletions RollingImage/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ class ViewController: UIViewController {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

// 背景のグレー
let grayView = UIView(frame: self.view.frame)
grayView.backgroundColor = UIColor.gray
self.view.addSubview(grayView)

// 画像
let image = UIImage(named: "moon") // http://icooon-mono.com/11223-夜空のフリーアイコン/ より
let imageView = UIImageView(image: image)
imageView.center = grayView.center
grayView.addSubview(imageView)

// アニメーション
let rollingAnimation = CABasicAnimation(keyPath: "transform.rotation")
rollingAnimation.fromValue = 0
rollingAnimation.toValue = CGFloat.pi * 2.0

rollingAnimation.duration = 2.0
rollingAnimation.repeatDuration = CFTimeInterval.infinity
imageView.layer.add(rollingAnimation, forKey: "rotateAnim")
rollingAnimation.duration = 2.0 // 周期2秒
rollingAnimation.repeatDuration = CFTimeInterval.infinity // 無限に
imageView.layer.add(rollingAnimation, forKey: "rotateAnim") // アニメーションを追加

}


}

0 comments on commit 8f53d00

Please sign in to comment.