WPF图像移动和旋转

时间:2016-04-16 09:00:15

标签: c# wpf image animation storyboard

首先,我在这里放置我的情况sreenshot:

enter image description here

所以我需要移动这些汽车(汽车是 private static void Eiti(Image target, double naujasX, double naujasY, double greitis, char kelias) { var top = Canvas.GetTop(target); var left = Canvas.GetLeft(target); top = Double.IsNaN(top) ? 0 : top; left = Double.IsNaN(left) ? 0 : left; naujasY = Paveikslas.canvasY(naujasY, kelias); var storyboard = new Storyboard(); greitis = 100 / greitis; // apverciamas greitis, kad butu logiska storyboard.Completed += Storyboard_Completed; if (naujasY != -1) // isejimo simbolis (escape) { DoubleAnimation anim1 = new DoubleAnimation(top, naujasY, TimeSpan.FromSeconds(greitis)); Storyboard.SetTarget(anim1, target); Storyboard.SetTargetProperty(anim1, new PropertyPath(Canvas.TopProperty)); storyboard.Children.Add(anim1); DoubleAnimation anim2 = new DoubleAnimation(left, naujasX, TimeSpan.FromSeconds(greitis)); Storyboard.SetTarget(anim2, target); Storyboard.SetTargetProperty(anim2, new PropertyPath(Canvas.LeftProperty)); storyboard.Children.Add(anim2); } storyboard.Begin(); } s)箭头所在的位置。 为了直接驾驶我使用此功能:

screenshot
  

它对我有用!

但是现在我在旋转和驾驶汽车的同时遇到了问题(例如在<div id="wrap"> <header>text</header> <div id="a">text</div> <div id="b">text</div> </div> 开车穿过绿色广场时)。

  

是否有任何功能或其他方法可以解决这个问题?

0 个答案:

没有答案