暂停故事板时,动画属性是否被锁定? AnimationClock会停止吗?

时间:2011-12-13 15:37:33

标签: wpf animation storyboard pixelsense scatterview

ParallelTimeline OTimelineAnimation = new ParallelTimeline();

for (int i = 0; i < _Bubbles.Count; i++)
{
 _StryBrd.Children.Clear();

 PointAnimation ToMovePointAnim = new PointAnimation();
 ToMovePointAnim.From = _Bubbles[i].CurrentPoint;
 ToMovePointAnim.To = _Bubbles[i].ToNextPoint;
 ToMovePointAnim.Duration = new Duration(TimeSpan.FromSeconds(1.5));
 ToMovePointAnim.FillBehavior = FillBehavior.Stop;

 Storyboard.SetTarget(ToMovePointAnim, _Bubbles[i].CurrentElement);
 Storyboard.SetTargetProperty(ToMovePointAnim, new PropertyPath(ScatterViewItem.CenterProperty));

 OTimelineAnimation.Children.Add(ToMovePointAnim);

 _Bubbles[i].CurrentElement.Center = _Bubbles[i].ToNextPoint;
 _Bubbles[i].CurrentPoint = _Bubbles[i].ToNextPoint;
 _Bubbles[i].ToNextPoint = GetToNextPoint(_Bubbles[i].ToNextPoint);
}

_StryBrd.Children.Add(OTimelineAnimation);
_StryBrd.Begin(this,  true);


// At another part X, I call the following
_StryBrd.Pause(this);

// At another part Y, I call the following
_StryBrd.Resume(this);

问题:

当我尝试拖动其中任何一个&#34; ScatterViewItem&#34;内部(我猜!)它正在访问&#34; ScatterViewItem.CenterProperty&#34;某种程度上改变了元素的位置,它没有被拖拽。

这是暂停故事板的默认行为吗? (要锁定属性不被更改)

我希望我已经澄清了,提前全部谢谢

1 个答案:

答案 0 :(得分:1)

嗯,动画非常极端precedence,即使暂停也无法修改动画属性。只是setting a property after an animation很麻烦,在这里你还需要摆脱动画来改变它。