             //NSAssert(values.count == 3, @"Incorrect number of values passed for MLContinous-type animation")
             totalDuration = delay + interval
             // Set up keyTimes
-            animation.keyTimes = [
+            keyTimes = [
                 0.0,                        // Initial location, home
                 delay/totalDuration,        // Initial delay, at home
                 1.0                         // Animation to away

    }
}

private extension CAMediaTimingFunction {
    
    func durationPercentageForPositionPercentage(_ positionPercentage: CGFloat, duration: CGFloat) -> CGFloat {
        // Finds the animation duration percentage that corresponds with the given animation "position" percentage.

        
        // Calculate times based on marquee type
        let totalDuration: CGFloat
        let keyTimes: [CGFloat]
        
        switch (type) {
        case .leftRight, .rightLeft:
            //NSAssert(values.count == 5, @"Incorrect number of values passed for MLLeftRight-type animation")
            totalDuration = 2.0 * (delay + interval)
            // Set up keyTimes
            keyTimes = [
                0.0,                                            // Initial location, home
                delay/totalDuration,                            // Initial delay, at home
                (delay + interval)/totalDuration,               // Animation to away
