【发布时间】:2019-05-10 11:32:22
【问题描述】:
我已经通过代码创建了Storyboard,在动画过程中我需要阅读一些properties,例如From 和To 等。如何做到这一点?我需要获取这些信息,因为在动画期间需要添加/删除/编辑效果。
Storyboard 使用DoubleAnimation。以下简短示例显示了我如何获得一些值,但我找不到如何获得 From 或 To 值的方法。 Timeline(或Storyboard)没有这些值。
//GET EFFECT - THIS CALL GETS ADDED ANIMATION IN STORYBOARD
Timeline TargetEffect = GetEffect(AnimationName, AnimationEffectType.Opacity);
//FROM
double From = (TargetElement as FrameworkElement).Opacity;
//DURATION
TimeSpan Duration = TargetEffect.Duration.TimeSpan;
//DELAY
TimeSpan Delay = TargetEffect.BeginTime.Value;
//REPEAT
RepeatBehavior Repeat = TargetEffect.RepeatBehavior;
//REVERSE
bool AutoReverse = TargetEffect.AutoReverse;
//FROM OR TO ????
【问题讨论】:
-
如果你能提供minimal reproducible example就太好了
标签: c# animation uwp storyboard dependency-properties