         }
         
         if (animated) {
-            // Create animation for location change
-            let locationAnimation = CABasicAnimation(keyPath: "locations")
-            locationAnimation.fromValue = gradientMask.locations
-            locationAnimation.toValue = adjustedLocations
-            locationAnimation.duration = 0.25
-            
-            // Create animation for location change
+            // Finish transaction
+            CATransaction.commit()
+            
+            // Create animation for color change
             let colorAnimation = CABasicAnimation(keyPath: "colors")
-            colorAnimation.fromValue = gradientMask.locations
+            colorAnimation.fromValue = gradientMask.colors
             colorAnimation.toValue = adjustedColors
-            colorAnimation.duration = 0.25
-            
-            // Create animation group
-            let group = CAAnimationGroup()
-            group.animations = [locationAnimation, colorAnimation]
-            group.duration = 0.25
-            
-            gradientMask.addAnimation(group, forKey: colorAnimation.keyPath)
-            gradientMask.locations = adjustedLocations
-            gradientMask.colors = adjustedColors
+            colorAnimation.fillMode = kCAFillModeForwards
+            colorAnimation.removedOnCompletion = false
+            colorAnimation.delegate = self
+            colorAnimation.setValue(adjustedColors, forKey: "setupColors")
+            gradientMask.addAnimation(colorAnimation, forKey: "setupColors")
         } else {
-            CATransaction.begin()
-            CATransaction.setValue(kCFBooleanTrue, forKey: kCATransactionDisableActions)
-            gradientMask.locations = adjustedLocations
             gradientMask.colors = adjustedColors
             CATransaction.commit()
         }

            
        case .Continuous:
            values = [
                [opaque, opaque, opaque, transp],           // Initial gradient
                [opaque, opaque, opaque, transp],           // Begin of fade in
                [transp, opaque, opaque, transp],           // End of fade in, just as scroll away starts
                [transp, opaque, opaque, transp],           // Begin of fade out, just before scroll home completes

        }
        
        // Define values
        // Get current layer values
        let mask = self.layer.mask?.presentationLayer() as? CAGradientLayer
        let currentValues = mask?.colors as? [CGColorRef]
        
        switch (type) {
        case .ContinuousReverse:
            values = [
                currentValues ?? [transp, opaque, opaque, opaque],           // Initial gradient
                [transp, opaque, opaque, opaque],           // Begin of fade in
                [transp, opaque, opaque, transp],           // End of fade in, just as scroll away starts
                [transp, opaque, opaque, transp],           // Begin of fade out, just before scroll home completes
