图像的弹跳效果从上到下wp8

时间:2015-07-15 12:45:45

标签: c# windows-phone-8 storyboard

如何在wp8中实现对图像的弹跳效果?实际上我想制作动画从上到下弹跳图像。

我参考了以下链接

http://w3facility.org/question/how-to-add-bounce-effect-to-dynamically-created-images-in-winrt/

我的代码:

      var sb = new Storyboard();
        Storyboard.SetTarget(sb, image);
        sb.RepeatBehavior = RepeatBehavior.Forever;
        sb.AutoReverse = true;
        var da = new DoubleAnimation();
        Storyboard.SetTargetProperty(da, new PropertyPath("Height"));
        da.From = 0;
        da.To = 500;           
        da.Duration = TimeSpan.FromSeconds(1d);
        da.EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut };
        sb.Children.Add(da);
        sb.Begin();

请帮忙吗?

1 个答案:

答案 0 :(得分:0)

尝试启用相关动画:

da.EnableDependentAnimation = true;
希望它有所帮助。