我需要知道Composition
之类的ScalarKeyFrameAnimation
动画何时完成。这该怎么做?我打了如下电话:
public void Start()
{
if (!IsLoaded) return;
//SET TARGET PROPERTY - OPACITY
TargetScalarKeyFrameAnimation.Target = "Opacity";
//SET FROM OPACITY
if (From < 0) this.Opacity = 0;
else if (From > 1) this.Opacity = 1;
else this.Opacity = From;
//SET FINAL VALUE (OPACITY)
if (To < 0) TargetScalarKeyFrameAnimation.InsertKeyFrame(1f, 0);
else if (To > 1) TargetScalarKeyFrameAnimation.InsertKeyFrame(1f, 1);
else TargetScalarKeyFrameAnimation.InsertKeyFrame(1f, (float)To);
//SET DURATION
if (Duration.TotalMilliseconds > 0) TargetScalarKeyFrameAnimation.Duration = Duration;
else TargetScalarKeyFrameAnimation.Duration = TimeSpan.FromSeconds(1);
//SET DELAY
if (Delay.TotalMilliseconds > 0) TargetScalarKeyFrameAnimation.DelayTime = Delay;
else TargetScalarKeyFrameAnimation.DelayTime = TimeSpan.FromMilliseconds(0);
//START
this.StartAnimation(TargetScalarKeyFrameAnimation);
}
但是如何获得通知动画已经完成?这将有助于同步UI和其他动画。 StoryboardAnimation
为此发生了一个事件。