/// <summary> /// Updates the slide animation. /// </summary> /// <param name="control">The control for which the animation needs to be updated.</param> /// <param name="storyboard">Storyvoard that needs to be updated.</param> /// <param name="target">The targeted element of the animation.</param> /// <param name="args"></param> /// <remarks> /// Currently the method sets the SpeedRatio of the storyboard to /// the global <strong>AnimationSpeedRatio</strong> if the local SpeedRatio is null. /// If the local SpeedRatio value is set, it will be used. /// </remarks> protected override void UpdateAnimationOverride(FrameworkElement control, Storyboard storyboard, FrameworkElement target, params object[] args) { this.UpdateSlideMode(target, args); if (target.ActualHeight == 0) { // TODO: Discuss LayoutUpdate here. target.UpdateLayout(); } var value = target.ActualHeight; var nonZeroValue = this.SlideMode == SlideMode.Top ? 1.0 : -1.0; var relativeFrom = this.GetValueDependingOnDirection(nonZeroValue, 0.0); var relatoveTo = this.GetValueDependingOnDirection(0.0, nonZeroValue); value *= -1 * nonZeroValue; var fromValue = this.GetValueDependingOnDirection(value, 0.0); var endValue = this.GetValueDependingOnDirection(0.0, value); var duration = RadAnimation.GetDurationSecondsForLength(Math.Abs(value)); var splineToUse = this.GetValueDependingOnDirection(Easings.SlideDown1, Easings.SlideUp1); storyboard.Update() .Animate(target) .OpacityMaskRelativeMoveY(0, relativeFrom, duration, relatoveTo) .Easings(splineToUse) .MoveY(0, fromValue, duration, endValue) .Easings(splineToUse); DisableControlWhileAnimationIsRunning(target, storyboard); }
/// <summary> /// Updates the slide animation. /// </summary> /// <param name="control">The control for which the animation needs to be updated.</param> /// <param name="storyboard">Storyvoard that needs to be updated.</param> /// <param name="target">The targeted element of the animation.</param> /// <param name="args"></param> /// <remarks> /// Currently the method sets the SpeedRatio of the storyboard to /// the global <strong>AnimationSpeedRatio</strong> if the local SpeedRatio is null. /// If the local SpeedRatio value is set, it will be used. /// </remarks> protected override void UpdateAnimationOverride(FrameworkElement control, Storyboard storyboard, FrameworkElement target, params object[] args) { var relativeFrom = this.GetValueDependingOnDirection(this.MinOpacity, this.MaxOpacity); var relativeTo = this.GetValueDependingOnDirection(this.MaxOpacity, this.MinOpacity); var duration = RadAnimation.GetDurationSecondsForLength(200.0); storyboard.Update() .Animate(target) .Opacity(0, relativeFrom, duration, relativeTo) .Easings(this.Easing) .AdjustSpeed(); }
/// <summary> /// Updates the slide animation. /// </summary> /// <param name="control">The control for which the animation needs to be updated.</param> /// <param name="storyboard">Storyvoard that needs to be updated.</param> /// <param name="target">The targeted element of the animation.</param> /// <param name="args"></param> /// <remarks> /// Currently the method sets the SpeedRatio of the storyboard to /// the global <strong>AnimationSpeedRatio</strong> if the local SpeedRatio is null. /// If the local SpeedRatio value is set, it will be used. /// </remarks> protected override void UpdateAnimationOverride(FrameworkElement control, Storyboard storyboard, FrameworkElement target, params object[] args) { var relativeFrom = this.GetValueDependingOnDirection(this.MinScale, this.MaxScale); var relativeTo = this.GetValueDependingOnDirection(this.MaxScale, this.MinScale); var duration = RadAnimation.GetDurationSecondsForLength(100.0); storyboard.Update() .Animate(target) .EnsureDefaultTransforms() .ScaleX(0, relativeFrom, duration, relativeTo) .Easings(this.Easing) .ScaleY(0, relativeFrom, duration, relativeTo) .Easings(this.Easing) .AdjustSpeed(); }