                     guard anim.duration == animationGroup.duration else { fatalError("All animations in an animation group must have the same duration.") }
                     
                     let keyframeAnimation = getKeyframeAnimation(anim)
-                    keyframeAnimation.duration = anim.duration
-                    keyframeAnimation.fillMode = kCAFillModeForwards
-                    keyframeAnimation.removedOnCompletion = false
-                    keyframeAnimation.values = getValues(updatedValues[anim.property], animation: anim)
-                    
-                    updatedValues[anim.property] = anim.endValue
+                    keyframeAnimation.values = getValues(updatedValues, animation: anim)
                     
                     groupedAnimations.append(keyframeAnimation)
+
+                    updateValues(updatedValues, animation: anim)
                 }
                 
                 animationGroup.animations = groupedAnimations
                 
-                totalDuration += animationGroup.duration
+                totalDuration = animationGroup.beginTime + animationGroup.duration
                 chainedAnims.append(animationGroup)
             }
         }

//
//  Animation.swift
//  KRAnimation
//
//  Created by Joshua Park on 6/17/16.

    case ShadowColor
    case ShadowOffset
    case ShadowOpacity
    case ShadowPath
    case ShadowRadius
    
    case Transform
    
    case RotationX
    case RotationY
    case RotationZ
    case Rotation
    
    case ScaleX
    case ScaleY
    case ScaleZ
    case Scale
    
    case TranslationX
    case TranslationY
    case TranslationZ
