CSharp examples for Windows.UI.Xaml.Media.Animation:Animation
Get Animated Brush
using System.Windows.Media.Animation; using System.Windows.Media; using System;//from w w w . ja v a 2s . c o m public class Main{ public static Brush GetAnimatedBrush(Color fromColor, Color toColor, TimeSpan ts) { ColorAnimationUsingKeyFrames ani = new ColorAnimationUsingKeyFrames(); LinearColorKeyFrame f1 = new LinearColorKeyFrame(fromColor) {KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 200))}; EasingColorKeyFrame f2 = new EasingColorKeyFrame(toColor) {KeyTime = KeyTime.FromTimeSpan(ts)}; ani.KeyFrames.Add(f1); ani.KeyFrames.Add(f2); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(0, 75, 75, 75)); brush.BeginAnimation(SolidColorBrush.ColorProperty, ani); return brush; } }