沿着带有图像的弯曲路径

时间:2013-02-22 11:13:46

标签: animation windows-8 microsoft-metro expression-blend

我正在尝试在Windows应用商店应用中跟踪带有图像的路径。我希望图像遵循该路径并在其跟随时旋转。在飞机上做一个曲线或类似this的事情。

在silverlight / wpf的教程中,我发现了一些我在Windows应用商店应用中没有的东西,例如:DoubleAnimationUsingPathMatrixAnimationUsingPath甚至PathListBox

我也尝试在Blend中制作动画(虽然我在windows世界的经验很小,但是混合的经验更糟糕)但是我甚至不能Path -> Make Layout Path

如何在windows metro应用程序中执行类似unicycle animation的操作?

修改

我想使用路径,因为我想随机生成这些路径。手动混合中的关键帧适用于特定的受控路径。但是,随机生成这些关键帧似乎需要做更多的工作,只需生成可以遵循的随机弧路径。

2 个答案:

答案 0 :(得分:2)

我最终移植了Petzold解决方案(Hermit Dave给出的解决方案,我试图避免)。

然而,我不得不做一些改变。

我将“xFormUnicycleMan”MatrixTransform作为MatrixAnimationUsingPath的depdendency属性传递给:

TargetElement="{Binding ElementName=xformUnicycleMan}"

然后,在OnCompositionTargetRendering我得到它并且我使用以下内容修改了我需要采用的值:

MatrixTransform matrixTransform = this.TargetElement as MatrixTransform;
PropertyPath targetProperty = new PropertyPath("MatrixProperty");
PropertyInfo fieldInfo = 
    matrixTransform.GetType().GetRuntimeProperty(targetProperty.Path);  
DependencyProperty dependencyProp = 
    fieldInfo.GetValue(matrixTransform) as DependencyProperty;

感谢@Miek提供的帮助。

如果某人有更好的解决方案,我会赞成。

答案 1 :(得分:0)

Charles Petzold在这里发布了他被黑的MatrixAnimationUsingPath

http://www.charlespetzold.com/blog/2008/11/250534.html

下载源(zip文件)并移植它

相关问题