Wc.CompositionAnimation GetCompositionAnimation(Wd.CompositionAnimation obj) { switch (obj.Type) { case Wd.CompositionObjectType.ExpressionAnimation: return(GetExpressionAnimation((Wd.ExpressionAnimation)obj)); case Wd.CompositionObjectType.ColorKeyFrameAnimation: return(GetColorKeyFrameAnimation((Wd.ColorKeyFrameAnimation)obj)); case Wd.CompositionObjectType.PathKeyFrameAnimation: return(GetPathKeyFrameAnimation((Wd.PathKeyFrameAnimation)obj)); case Wd.CompositionObjectType.ScalarKeyFrameAnimation: return(GetScalarKeyFrameAnimation((Wd.ScalarKeyFrameAnimation)obj)); case Wd.CompositionObjectType.Vector2KeyFrameAnimation: return(GetVector2KeyFrameAnimation((Wd.Vector2KeyFrameAnimation)obj)); case Wd.CompositionObjectType.Vector3KeyFrameAnimation: return(GetVector3KeyFrameAnimation((Wd.Vector3KeyFrameAnimation)obj)); default: throw new InvalidOperationException(); } }
T CacheAndInitializeAnimation <T>(Wd.CompositionAnimation source, T target) where T : Wc.CompositionAnimation { CacheAndInitializeCompositionObject(source, target); foreach (var parameter in source.ReferenceParameters) { target.SetReferenceParameter(parameter.Key, GetCompositionObject(parameter.Value)); } if (!string.IsNullOrWhiteSpace(source.Target)) { target.Target = source.Target; } return(target); }
private protected CompositionAnimation(CompositionAnimation other) { if (other != null) { foreach (var pair in other._referencedParameters) { _referencedParameters.Add(pair.Key, pair.Value); } Target = other.Target; ((IDescribable)this).LongDescription = ((IDescribable)other).LongDescription; ((IDescribable)this).ShortDescription = ((IDescribable)other).ShortDescription; Comment = other.Comment; } }
/// <summary> /// Binds an animation to a property. /// </summary> /// <param name="target">The name of the property.</param> /// <param name="animation">The animation.</param> public void StartAnimation(string target, CompositionAnimation animation) { // Clone the animation so that the existing animation object can be reconfigured. // If the animation is frozen, it is safe to not do the clone. var clone = animation.IsFrozen ? animation : animation.Clone(); var animator = new Animator { Animation = clone, AnimatedProperty = target, AnimatedObject = this, }; if (!(animation is ExpressionAnimation)) { animator.Controller = new AnimationController(this, target); } _animators.Add(animator); }