public Timeline GetAnimation(DependencyObject targetHint) { EasingFunctionBase?easingFunction = EasingType.ToEasingFunction(EasingMode); if (typeof(T) == typeof(float)) { return(targetHint.CreateDoubleAnimation( Property, GetToAs <float>(), GetFromAs <float>(), Delay, Duration, easingFunction, Repeat.ToRepeatBehavior(), enableDependecyAnimations: true)); } if (typeof(T) == typeof(double)) { return(targetHint.CreateDoubleAnimation( Property, GetToAs <double>(), GetFromAs <double>(), Delay, Duration, easingFunction, Repeat.ToRepeatBehavior(), enableDependecyAnimations: true)); } if (typeof(T) == typeof(Point)) { return(targetHint.CreatePointAnimation( Property, GetToAs <Point>(), GetFromAs <Point>(), Delay, Duration, easingFunction, Repeat.ToRepeatBehavior(), enableDependecyAnimations: true)); } if (typeof(T) == typeof(Color)) { return(targetHint.CreateColorAnimation( Property, GetToAs <Color>(), GetFromAs <Color>(), Delay, Duration, easingFunction, Repeat.ToRepeatBehavior())); } throw new InvalidOperationException("Invalid animation type"); }