我的目标是在for循环中为动态创建的图像提供反弹效果。
答案 0 :(得分:0)
var sb = new Storyboard();
Storyboard.SetTarget(sb, imageTranslateTransform);
sb.RepeatBehavior = RepeatBehavior.Forever;
sb.AutoReverse = true;
var da = new DoubleAnimation();
Storyboard.SetTargetProperty(da, "Y");
da.From = 0;
da.To = 100;
da.Duration = TimeSpan.FromSeconds(1d);
da.EasingFunction = new QuadraticEase {EasingMode = EasingMode.EaseOut};
sb.Children.Add(da);
sb.Begin();