animation - 使用图像沿着弯曲路径行走

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

我正在尝试遵循 Windows 应用商店应用程序中的图像路径。我希望图像遵循该路径并在遵循该路径时旋转。想象一下在平面上做曲线或类似的事情 this .

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

我也尝试过在Blend中做那个动画(虽然我在windows世界的经验很少,但在blend中的体验更糟糕)但我什至做不到Path -> Make Layout Path .

我怎样才能做类似 unicycle animation 的事情在 Windows Metro 应用程序中?

编辑

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

最佳答案

我最终移植了 Petzold 解决方案(隐士戴夫给出的解决方案,我试图避免)。

但是,我必须做一些改变。

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

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 提供的帮助。

如果有人有更好的解决方案,我将不胜感激。

关于animation - 使用图像沿着弯曲路径行走,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15022867/

相关文章:

ios - 使用自动布局时*仅一个*动画 block (UILabel) 的问题

css - 无法使 SVG 圆圈动画化

c# - 如何剖析文本框是否被单击或点击 Windows 8

windows-8 - 如何检测 XAML slider 何时完成?

javascript - 在 Windows 8 Metro HTML5 应用程序中调整图像大小同时保持其质量?

ios - 点击即可调整 map View 的大小

android - animation.start() 或 animation.startNow() 不会立即启动动画

c# - 在 Windows 8 应用程序中从导航堆栈弹出页面

javascript - 从 Javascript 绑定(bind)到 MetroStyle 应用程序中的 InnerHTML

c# - WinRT - 以编程方式跳转到 C# 代码中的下一个控件