CSharp examples for Windows.UI.Xaml.Media.Animation:Animation
Create Scale Fade Out Effects
using Windows.UI.Xaml.Media.Animation; using Windows.UI.Xaml; using Windows.UI; using System;/*from ww w.j av a 2 s . c o m*/ public class Main{ public static Storyboard CreateScaleFadeOutEffects(UIElement target, TimeSpan beginTime, TimeSpan duration) { var scaleX = new DoubleAnimation { BeginTime = beginTime, Duration = duration, EasingFunction = new PowerEase(), To = 0, }; Storyboard.SetTarget(scaleX, target); Storyboard.SetTargetProperty(scaleX, "(UIElement.RenderTransform).(CompositeTransform.ScaleX)"); var scaleY = new DoubleAnimation { BeginTime = beginTime, Duration = duration, EasingFunction = new PowerEase(), To = 0, }; Storyboard.SetTarget(scaleY, target); Storyboard.SetTargetProperty(scaleY, "(UIElement.RenderTransform).(CompositeTransform.ScaleY)"); var opacityIn = new DoubleAnimation { BeginTime = beginTime, Duration = duration, EasingFunction = new PowerEase { EasingMode = EasingMode.EaseIn }, To = 0, }; Storyboard.SetTarget(opacityIn, target); Storyboard.SetTargetProperty(opacityIn, "Opacity"); var sb = new Storyboard(); sb.Children.Add(scaleX); sb.Children.Add(scaleY); sb.Children.Add(opacityIn); return sb; } }