Animate Opacity From 1 to 0 - CSharp Windows.UI.Xaml.Media.Animation

CSharp examples for Windows.UI.Xaml.Media.Animation:Animation

Description

Animate Opacity From 1 to 0

Demo Code


using System.Windows.Media.Animation;
using System.Windows;
using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from w  ww  .  j  ava2 s  .c om*/

public class Main{
        public static AnimationTimeline OpacityFrom1to0(int seconds)
      {
         DoubleAnimation animation = new DoubleAnimation();
         animation.From = 1.0;
         animation.To = 0.0;
         animation.Duration = new Duration(TimeSpan.FromSeconds(seconds));

         return animation;
      }
}

Related Tutorials