コメントで要求されたように、アニメーションを作成するために最終的に使用したものを説明します。
私は Silverlight でアニメーション化されたポリライン補間を追跡し、多かれ少なかれこのコードを直接使用しました - PointCollectionInterpolator.cs クラスを「盗みます」。
次に、必要なポリゴンを作成し、アニメーションを準備する方法がありました。
private void CreatePolygon(TextBox txtbx, string prop, Color curcol)
{
PointCollectionInterpolator pci = new PointCollectionInterpolator();
pci.Points1 = new PointCollection() // Start Points
{
new Point(...),
new Point(...),
new Point(...),
new Point(...),
};
pci.Points2 = new PointCollection() // End Points
{
new Point(...),
new Point(...),
new Point(...),
new Point(...),
};
Polygon tmpply = new Polygon();
LayoutRoot.Children.Add(tmpply);
tmpply.Points = pci.InterpolatedPoints;
DoubleAnimation animpci = new DoubleAnimation();
animpci.Duration = someDuration;
animpci.From = 0.0;
animpci.To = 1.0;
Storyboard.SetTarget(animpci, pci);
Storyboard.SetTargetProperty(animpci, new PropertyPath("(Progress)"));
myStoryBoard.Children.Add(animpci);
}
そして、いくつかのランダム イベント ハンドラーで、アニメーションを開始します。さらに、メソッドを再利用できるように、終点コレクションを開始点コレクションに移動し、新しい終点でインターポレーターを更新しました。(進行状況を 0.0 に設定したことを思い出してください...) したがって、ハンドラーが起動するたびに、ポリゴンはシームレスに新しいポリゴンに変化します。
private void SomeEventHandler(object sender, RoutedEventArgs e)
{
PointCollectionInterpolator polygonPCI =
this.referenceToPointCollectionInterpolator;
polygonPCI.Points1 = polygonPCI.Points2;
polygonPCI.Progress = 0.0;
polygonPCI.Points2 = getNewEndPoints();
myStoryBoard.Begin();
}
振り返ってみると、名前を Points1 と Points2 から StartPoints と EndPoints それぞれに変更します。これが役に立ったことを願っています。:)