Skip to content

Instantly share code, notes, and snippets.

@shakked
Created April 21, 2015 03:56
Show Gist options
  • Save shakked/ae48c301e24551ede65d to your computer and use it in GitHub Desktop.
Save shakked/ae48c301e24551ede65d to your computer and use it in GitHub Desktop.
gravity.action
gravity.action = { () -> (Void) in
for paintBall in self.paintBalls {
if !contains(self.paintBallsToBeRelocated, paintBall) {
self.drawLineFrom(paintBall.lastPoint, toPoint: paintBall.center, color: paintBall.backgroundColor!, brushWidth: self.paintBallRadius * 2)
paintBall.lastPoint = paintBall.center
if self.shouldRelocatePaintBall(paintBall) {
if !contains(self.paintBallsToBeRelocated, paintBall) {
self.paintBallsToBeRelocated.append(paintBall)
}
if (self.paintBallsToBeRelocated.count == self.paintBalls.count) {
self.resetPaintBallPositions()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment