如何将动画录制到视频中

时间:2012-03-15 18:01:49

标签: c# windows-phone-7

我已完成蜡烛动画教程here但我想保存此动画并将其转换为视频,以便我可以播放,暂停,快退和快进。我将如何实现这一目标。你能救我吗?

这是我的代码

private void OnLoaded(object sender, RoutedEventArgs e)
    {
        var storyboard = new Storyboard
        {
            RepeatBehavior = RepeatBehavior.Forever
        };

        var animation = new ObjectAnimationUsingKeyFrames();

        Storyboard.SetTarget(animation, CandleImage);
        Storyboard.SetTargetProperty(animation, new PropertyPath("Source"));

        storyboard.Children.Add(animation);

        for (int i = 1; i <= 60; i++)
        {
            var keyframe = new DiscreteObjectKeyFrame
            {
                KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(50 * i)),
                Value = String.Format("/Images/candle_{0:D2}.jpg", i)
            };

            animation.KeyFrames.Add(keyframe);
        }

        Resources.Add("CandleStoryboard", storyboard);

        storyboard.Begin();
    }

1 个答案:

答案 0 :(得分:0)

您可以使用Storyboard完成所有这些操作。请参阅Pause()和Resume()等方法以及SpeedRatio属性。