             //        UIColor.whiteColor().setStroke()
             //        path.stroke()
             
-            
-            var shapeLayer = CAShapeLayer()
             shapeLayer.strokeEnd = 1.0
             shapeLayer.path = path.CGPath
             shapeLayer.strokeColor = UIColor.whiteColor().CGColor


class GameTestViewController: UIViewController {
    
    var grid: GOGrid?
    var object: GOOpticRep?
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view, typically from a nib.
        self.view.backgroundColor = UIColor.grayColor()
        self.grid = GOGrid(width: 512,
            height: 384,
            andUnitLength: 2)
        
        let swipeGesture = UISwipeGestureRecognizer(target: self, action: Selector("didSwipe:"))
        self.view.addGestureRecognizer(swipeGesture)
    }
    
    override func viewDidAppear(animated: Bool) {
        drawLight()

    
    func drawLight() {
        if let opticRep = self.object {

            let bezierPath = opticRep.bezierPath

            shapeLayer.strokeEnd = 1.0
            shapeLayer.path = bezierPath.CGPath
            shapeLayer.strokeColor = UIColor.whiteColor().CGColor
            shapeLayer.fillColor = UIColor.clearColor().CGColor
            shapeLayer.lineWidth = 2.0

            
            let pathAnimation = CABasicAnimation(keyPath: "strokeEnd")
            pathAnimation.fromValue = 0.0;
            pathAnimation.toValue = 1.0;
            pathAnimation.duration = 0.1;
            pathAnimation.repeatCount = 1.0
            pathAnimation.fillMode = kCAFillModeForwards
            pathAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
            
            shapeLayer.addAnimation(pathAnimation, forKey: "strokeEnd")

            
            
        } else {
