Archive for 2012年9月25日

Storyboard の例

2012年9月25日

 

Storyboard sb1 = new Storyboard();

DoubleAnimationUsingKeyFrames daukf1 = new DoubleAnimationUsingKeyFrames();
daukf1.Duration = TimeSpan.FromSeconds(5);

EasingDoubleKeyFrame ldkf1 = new EasingDoubleKeyFrame();
ldkf1.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0));
ldkf1.Value = 0;
EasingDoubleKeyFrame ldkf2 = new EasingDoubleKeyFrame();
ldkf2.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 5));
ldkf2.Value = 100;

daukf1.BeginTime = TimeSpan.FromSeconds(0);
daukf1.Duration = TimeSpan.FromSeconds(5);
daukf1.KeyFrames.Add(ldkf1);
daukf1.KeyFrames.Add(ldkf2);

Storyboard.SetTarget(daukf1, path);
Storyboard.SetTargetProperty(daukf1, new PropertyPath(Path.WidthProperty));
          

sb1.Children.Add(daukf1);
sb1.Begin();

広告