         time += link.duration
         
         if time < 4.0 {
-            
-            let offset = CGFloat(1600.0 * time * Double(sin(time * π * 2.0 / 0.4)) * Double(exp(-5.0 * time)))
-            let offset2 = CGFloat(1400.0 * time * Double(sin(time * π * 2.0 / 0.4 + π * 0.9)) * Double(exp(-5.0 * time)))
-            
-            let controlPoint1 = CGPoint(x: (topLeft.x      + topRight.x            )/2,
-                y: (topLeft.y      + topRight.y    - offset2)/2)
-            let controlPoint2 = CGPoint(x: (topRight.x     + bottomRight.x + offset)/2,
-                y: (topRight.y     + bottomRight.y         )/2)
-            let controlPoint3 = CGPoint(x: (bottomRight.x  + bottomLeft.x          )/2,
-                y: (bottomRight.y  + bottomLeft.y  + offset2)/2)
-            let controlPoint4 = CGPoint(x: (bottomLeft.x   + topLeft.x     - offset)/2,
-                y: (bottomLeft.y   + topLeft.y             )/2)
-            
-            let path = UIBezierPath()
-            path.moveToPoint(topLeft)
-            path.addQuadCurveToPoint(topRight,    controlPoint: controlPoint1)
-            path.addQuadCurveToPoint(bottomRight, controlPoint: controlPoint2)
-            path.addQuadCurveToPoint(bottomLeft,  controlPoint: controlPoint3)
-            path.addQuadCurveToPoint(topLeft,     controlPoint: controlPoint4)
-            path.closePath()
-            
-            shapeLayer.path = path.CGPath
-
+           drawPath()
         }
+        
     }
     
     func drawPath(){
         
+        let offset = CGFloat(1600.0 * time * Double(sin(time * π * 2.0 / 0.4)) * Double(exp(-5.0 * time)))
+        let offset2 = CGFloat(1400.0 * time * Double(sin(time * π * 2.0 / 0.4 + π * 0.9)) * Double(exp(-5.0 * time)))
+        
+        let controlPoint1 = CGPoint(x: (topLeft.x      + topRight.x            )/2,
+                                    y: (topLeft.y      + topRight.y    - offset2)/2)
+        let controlPoint2 = CGPoint(x: (topRight.x     + bottomRight.x + offset)/2,
+                                    y: (topRight.y     + bottomRight.y         )/2)
+        let controlPoint3 = CGPoint(x: (bottomRight.x  + bottomLeft.x          )/2,
+                                    y: (bottomRight.y  + bottomLeft.y  + offset2)/2)
+        let controlPoint4 = CGPoint(x: (bottomLeft.x   + topLeft.x     - offset)/2,
+                                    y: (bottomLeft.y   + topLeft.y             )/2)
+        
+        let path = UIBezierPath()
+        path.moveToPoint(topLeft)
+        path.addQuadCurveToPoint(topRight,    controlPoint: controlPoint1)
+        path.addQuadCurveToPoint(bottomRight, controlPoint: controlPoint2)
+        path.addQuadCurveToPoint(bottomLeft,  controlPoint: controlPoint3)
+        path.addQuadCurveToPoint(topLeft,     controlPoint: controlPoint4)
+        path.closePath()
+        
+        shapeLayer.path = path.CGPath
+
     }
     
     deinit {

    
    var displayLink : CADisplayLink!
    
    var time : CFTimeInterval = 0
    
    
    
    override init() {
        super.init()
        displayLink  = CADisplayLink(target: self, selector: "reDraw:")

        let tapGesture = UITapGestureRecognizer(target: self, action: "buttonTapped")
        self.addGestureRecognizer(tapGesture)
        
        shapeLayer.fillColor = UIColor.orangeColor().CGColor
        
        layer.addSublayer(shapeLayer)
