Skip to content

Instantly share code, notes, and snippets.

@greggjaskiewicz
Created September 7, 2016 09:22
Show Gist options
  • Save greggjaskiewicz/af81adf749a5d3db7e04efeebb8a968e to your computer and use it in GitHub Desktop.
Save greggjaskiewicz/af81adf749a5d3db7e04efeebb8a968e to your computer and use it in GitHub Desktop.
let count = 15
let center = CGPoint(x: view.frame.width/2, y:view.frame.height/2)
button.center = center
let radius : CGFloat = 100
var angle = CGFloat(2 * M_PI)
for i in 1...count {
   let x = cos(angle) * radius + center.x
   let y = sin(angle) * radius + center.y
   let step = CGFloat(2 * M_PI) / CGFloat(count)
   let button = UIButton(frame: CGRect(x: x, y: y, width: 30, height: 30))
   let buttonAnimator = PulsateViewAnimator(view: button, pulseScale: 0.5, breathOutDuration: 0.2, holdDuration: 0.0, breathInDuration: 0.2, intervalBetweenPulses: 0.2+0.2+0.4)
   button.backgroundColor = UIColor.cyan
   button.setTitle("o/", for: .normal)
   button.titleLabel?.textColor = UIColor.black
   view.addSubview(button)
   button.center = CGPoint(x: x, y: y)
   angle += step
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment