public Storyboard CreateShowing(OverlaidContent target) { var content = (PictureViewContent)target; var duration = 250; var exponentialEase = new ExponentialEase() { EasingMode = EasingMode.EaseOut, Exponent = 5 }; var transform = content.PicturePreviewControl.GetTransformTo(content.SourceControl); var translateX = new TranslateX(content.PicturePreviewControl) { From = transform.TranslateX / 2, Duration = duration, EasingFunction = exponentialEase }; var translateY = new TranslateY(content.PicturePreviewControl) { From = transform.TranslateY / 2, Duration = duration, EasingFunction = exponentialEase }; var scaleX = new ScaleX(content.PicturePreviewControl) { From = transform.ScaleX + (1 - transform.ScaleX) / 2, To = 1, Duration = duration, EasingFunction = exponentialEase }; var scaleY = new ScaleY(content.PicturePreviewControl) { From = transform.ScaleY + (1 - transform.ScaleY) / 2, To = 1, Duration = duration, EasingFunction = exponentialEase }; var storyboard = new Storyboard(); storyboard.Children.Add(translateX.GetTimeline()); storyboard.Children.Add(translateY.GetTimeline()); storyboard.Children.Add(scaleX.GetTimeline()); storyboard.Children.Add(scaleY.GetTimeline()); return(storyboard); }
public Storyboard CreateHiding(OverlaidContent target) { var content = (PictureViewContent)target; var duration = 250; var exponentialEase = new ExponentialEase() { EasingMode = EasingMode.EaseOut, Exponent = 5 }; var transform = content.PicturePreviewControl.GetTransformTo(content.SourceControl); ApplyUniformToFillRule(content.PicturePreviewControl.RenderSize, content.SourceControl.RenderSize, transform); var translateX = new TranslateX(content.PicturePreviewControl) { To = transform.TranslateX, Duration = duration, EasingFunction = exponentialEase }; var translateY = new TranslateY(content.PicturePreviewControl) { To = transform.TranslateY, Duration = duration, EasingFunction = exponentialEase }; var scaleX = new ScaleX(content.PicturePreviewControl) { From = 1, To = transform.ScaleX, Duration = duration, EasingFunction = exponentialEase }; var scaleY = new ScaleY(content.PicturePreviewControl) { From = 1, To = transform.ScaleY, Duration = duration, EasingFunction = exponentialEase }; var background = new ValueSetterAnimation(content.LayoutControl, nameof(Background)) { Value = new SolidColorBrush(Colors.Transparent) }; var storyboard = new Storyboard(); storyboard.Children.Add(translateX.GetTimeline()); storyboard.Children.Add(translateY.GetTimeline()); storyboard.Children.Add(scaleX.GetTimeline()); storyboard.Children.Add(scaleY.GetTimeline()); storyboard.Children.Add(background.GetTimeline()); return(storyboard); }
private static Storyboard CreateSlideBackTransition(FrameworkElement target, FrameworkElement background) { var translateY = new TranslateY(target) { From = ((CompositeTransform)target.RenderTransform).TranslateY, Duration = 250, EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut, Exponent = 8 } }; var opacity = new Opacity(background) { From = background.Opacity, To = 1, Duration = 250, EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut, Exponent = 8 } }; var storyboard = new Storyboard(); storyboard.Children.Add(translateY.GetTimeline()); storyboard.Children.Add(opacity.GetTimeline()); return(storyboard); }