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 Storyboard CreateInteractionIndicationAnimation() { var scaleX = new ScaleX(LayoutControl) { From = 1, To = 1.3, Duration = 250, EasingFunction = new BackEase() { EasingMode = EasingMode.EaseOut } }; var scaleY = new ScaleY(LayoutControl) { From = 1, To = 1.3, Duration = 250, EasingFunction = new BackEase() { EasingMode = EasingMode.EaseOut } }; var storyboard = new Storyboard(); storyboard.Children.Add(scaleX.GetTimeline()); storyboard.Children.Add(scaleY.GetTimeline()); return(storyboard); }