视觉混合Annimating图像背景

时间:2015-09-02 10:45:25

标签: c# xaml background blend

Image from https://www.flickr.com/photos/markusspiske/14201997467/in/album-72157645103340985/ free for commercial use

如果用户启动应用程序,则应该有一个动画背景。 Maingrid的背景就是上面的图片。应该移动背景。我怎么能在Visual Blend中做到这一点?我知道如何在混合中创建annimations但我不知道如何做这种annimation。

2 个答案:

答案 0 :(得分:0)

你要求做的事(据我理解)是不可能的没有修改你从根本上显示的图像。

根据它的声音,你要做的就是在这个静态二维图像中动画指针。如果要将它打印到一张纸上并尝试相同的话,你就不能再动这个静态图像的时钟了。

一种解决方案是使用图片编辑工具(如photoshop)擦除有问题的指针,留下空的钟面。 从那里你可以将它用作你想要的背景,但是在现在修改过的图像上方的图层上创建资源,复制旧时钟指针的外观,并相应地为它们设置它们

(例如;应该像制作3个单独的动画一样简单,每个动画都有360度旋转,只有二手动画需要60秒才能完成,分钟拍摄1小时完成,当然还有12小时的时针完成它的旋转(但是你说你能够胜任动画,所以我会把这部分留给你)。)

答案 1 :(得分:0)

我相信你正在寻找类似的东西:

<Canvas.Resources>
  <Storyboard x:Name="myStoryboard">

    <!-- The PointAnimation has a name so it can be accessed
         from code. The To property is left out of the XAML
         because the value of To is determined in code. -->
    <PointAnimation
      x:Name="clockAnimation"
      Storyboard.TargetProperty="Center"
      Storyboard.TargetName="clockImage"
      Duration="0:0:20"/>
  </Storyboard>
</Canvas.Resources>

这个C#可以在定时器或初始化时完成:

double newX = 'Where you want the new X coordinate of the clock';
double newY = 'Where you want the new Y coordinate of the clock';
Point myPoint = new Point();
myPoint.X = newX;
myPoint.Y = newY;
clockAnimation.To = myPoint;
myStoryboard.Begin();

我希望这适合你!