LinearDoubleKeyFrame lf1 = new LinearDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 0, 0)), Value = 1 }; LinearDoubleKeyFrame lf2 = new LinearDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0,0,500)), Value = 0.5 }; LinearDoubleKeyFrame lf3 = new LinearDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 1, 0)), Value = 1 }; LinearDoubleKeyFrame lf4 = new LinearDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 1, 500)), Value = 0.5 }; LinearDoubleKeyFrame lf5 = new LinearDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0, 2, 0)), Value = 0 }; var ani_kf = new DoubleAnimationUsingKeyFrames(); ani_kf.KeyFrames.Add(lf1); ani_kf.KeyFrames.Add(lf2); ani_kf.KeyFrames.Add(lf3); ani_kf.KeyFrames.Add(lf4); ani_kf.KeyFrames.Add(lf5); popin = new Storyboard(); Storyboard.SetTarget(ani_kf, ShowText); Storyboard.SetTargetProperty(ani_kf, "Opacity"); popin.Children.Add(ani_kf);