如何在不运行时将 WPF Storyboard 寻找到特定的帧/时间偏移量 [英] How to seek a WPF Storyboard to a specific frame/time offset when not running

查看:29
本文介绍了如何在不运行时将 WPF Storyboard 寻找到特定的帧/时间偏移量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用 ClockController.SeekAlignedToLastTick 寻找特定的时间或帧 - 但是这似乎没有任何作用,除非 Storyboard 正在运行.我不想启动"故事板,因为我只想让故事板设置所有依赖属性值,并为该时间位置布置所有内容,以便我可以拍摄快照并前进到下一帧(我可以响应时钟事件并捕获帧,但随后我无法保证我会在我想要的正确时间获取快照).

I wish to seek to a specific time or frame using the ClockController.SeekAlignedToLastTick - however this does not appear to do anything, unless the Storyboard is running. I dont want to have to 'start' the storyboard, because I only intend the Storyboard to set all dependencyproperty values, and have everything lay-out for that time position, so that I can take a snapshot and advance to the next frame (I could respond to clock events and capture the frame, but then I couldnt guarantee I would get my snapshots at the correct times that I want).

如何简单地将 WPF 故事板推进到特定位置而不运行"它?

How can I simply advance a WPF storyboard to a specific position without 'running' it?

谢谢!

推荐答案

你必须至少开始动画才能找到它.但是,您可以开始,然后立即暂停,然后寻找.

You'll have to at least begin the animation before you can seek into it. You can however begin then pause right away, and seek.

// sb is a Storyboard
sb.Begin();
sb.Pause();
sb.SeekAlignedToLastTick(sometimespan);

这篇关于如何在不运行时将 WPF Storyboard 寻找到特定的帧/时间偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆