/// <summary> /// Inserts a KeyFrame in the KeyFrameAnimation by converting /// the given Expression to appropriate string /// </summary> /// <typeparam name="T">Type of the Expression</typeparam> /// <param name="animation">KeyFrameAnimation</param> /// <param name="normalizedProgressKey">The time the key frame should occur at, expressed as /// a percentage of the animation Duration. Allowed value is from 0.0 to 1.0.</param> /// <param name="expression">The expression used to calculate the value of the key frame.</param> /// <param name="easingFunction">Easing Function (optional)</param> /// <returns>KeyFrameAnimation</returns> public static KeyFrameAnimation InsertExpressionKeyFrame <T>(this KeyFrameAnimation animation, float normalizedProgressKey, Expression <CompositionLambda <T> > expression, CompositionEasingFunction easingFunction = null) { var result = CompositionExpressionEngine.CreateCompositionExpression(expression); animation.InsertExpressionKeyFrame(normalizedProgressKey, result.Expression, easingFunction); animation.SetParameters(result.Parameters); return(animation); }
/// <summary> /// Starts the given KeyFrameAnimation<> on the property specified by the given expression. /// The expression is converted to the appropriate property string by the /// CompositionExpressionEngine /// </summary> /// <typeparam name="T">Type of the property to be animated.</typeparam> /// <param name="compositionObject">CompositionObject</param> /// <param name="expression">Lambda expression defining the property on /// which the animation has to be started.</param> /// <param name="keyframeAnimation">The KeyFrameAnimation to run on the specified property.</param> public static void StartAnimation <T>(this CompositionObject compositionObject, Expression <Func <T> > expression, KeyFrameAnimation <T> keyframeAnimation) { compositionObject.StartAnimation(CompositionExpressionEngine.ParseExpression(expression), keyframeAnimation.Animation); }
/// <summary> /// Starts the given KeyFrameAnimation<> on the property specified by the given expression. /// The expression is converted to the appropriate property string by the /// CompositionExpressionEngine /// </summary> /// <typeparam name="T">Type of the property to be animated.</typeparam> /// <param name="compositionObject">CompositionObject</param> /// <param name="targetProperty">Property on which the animation has to be started.</param> /// <param name="keyframeAnimation">The KeyFrameAnimation to run on the specified property.</param> public static void StartAnimation <T>(this CompositionObject compositionObject, string targetProperty, KeyFrameAnimation <T> keyframeAnimation) { compositionObject.StartAnimation(targetProperty, keyframeAnimation.Animation); }
/// <summary> /// Ctor /// </summary> /// <param name="animation">The KeyFrameAnimation to encapsulate.</param> public KeyFrameAnimation(KeyFrameAnimation animation) { Animation = animation; }