@@ -55,12 +55,15 @@ class ViewController: UIViewController, MetaballDataSource {
5555 }
5656
5757 func addEdge(i: Int, _ j: Int) {
58− let parameters = EdgeAnimationParameters(startDate: NSDate(), duration: edgeAnimationDuration, fadeIn: true, i: i, j: j)
59− NSTimer.scheduledTimerWithTimeInterval(1.0/60.0, target: self, selector: "animateEdgeWithTimer:", userInfo: parameters, repeats: true)
58+ animateEdge(i, j, fadeIn: true)
6059 }
6160
6261 func removeEdge(i: Int, _ j: Int) {
63− let parameters = EdgeAnimationParameters(startDate: NSDate(), duration: edgeAnimationDuration, fadeIn: false, i: i, j: j)
62+ animateEdge(i, j, fadeIn: false)
63+ }
64+
65+ func animateEdge(i: Int, _ j: Int, fadeIn: Bool) {
66+ let parameters = EdgeAnimationParameters(startDate: NSDate(), duration: edgeAnimationDuration, fadeIn: fadeIn, i: i, j: j)
6467 NSTimer.scheduledTimerWithTimeInterval(1.0/60.0, target: self, selector: "animateEdgeWithTimer:", userInfo: parameters, repeats: true)
6568 }
6669