/// <summary> /// 在指定的属性上开始创建简易动画。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="targetPropertyPath"></param> /// <returns></returns> public EasyTransitionAnimationFluentContext <T> Animate <T>(string targetPropertyPath) { AnimationTypes type = AnimationTypes.NotSupport; Enum.TryParse(typeof(T).Name, true, out type); AnimationFluentContext result; switch (type) { case AnimationTypes.Single: result = new ScalarEasyTransitionAnimationFluentContext(this, Target.Compositor.CreateScalarKeyFrameAnimation(), targetPropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Vector2: result = new Vector2EasyTransitionAnimationFluentContext(this, Target.Compositor.CreateVector2KeyFrameAnimation(), targetPropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Vector3: result = new Vector3EasyTransitionAnimationFluentContext(this, Target.Compositor.CreateVector3KeyFrameAnimation(), targetPropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Vector4: result = new Vector4EasyTransitionAnimationFluentContext(this, Target.Compositor.CreateVector4KeyFrameAnimation(), targetPropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Color: result = new ColorEasyTransitionAnimationFluentContext(this, Target.Compositor.CreateColorKeyFrameAnimation(), targetPropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Quaternion: result = new QuaternionEasyTransitionAnimationFluentContext(this, Target.Compositor.CreateQuaternionKeyFrameAnimation(), targetPropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.NotSupport: default: throw new InvalidOperationException(""); } }
protected EasyTransitionAnimationFluentContext <T> Animate <T>(IAnimatableProperty <T> targetProperty) { AnimationFluentContext result; switch (targetProperty.AnimationType) { case AnimationTypes.Single: result = new ScalarEasyTransitionAnimationFluentContext(this, Target.Compositor.CreateScalarKeyFrameAnimation(), targetProperty.PropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Vector2: result = new Vector2EasyTransitionAnimationFluentContext(this, Target.Compositor.CreateVector2KeyFrameAnimation(), targetProperty.PropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Vector3: result = new Vector3EasyTransitionAnimationFluentContext(this, Target.Compositor.CreateVector3KeyFrameAnimation(), targetProperty.PropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Vector4: result = new Vector4EasyTransitionAnimationFluentContext(this, Target.Compositor.CreateVector4KeyFrameAnimation(), targetProperty.PropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Color: result = new ColorEasyTransitionAnimationFluentContext(this, Target.Compositor.CreateColorKeyFrameAnimation(), targetProperty.PropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.Quaternion: result = new QuaternionEasyTransitionAnimationFluentContext(this, Target.Compositor.CreateQuaternionKeyFrameAnimation(), targetProperty.PropertyPath); _animations.Add(result); return((EasyTransitionAnimationFluentContext <T>)result); case AnimationTypes.NotSupport: default: throw new InvalidOperationException(""); } }