如何在 Qt 中创建旋转立方体效果?

发布于 2024-09-24 11:47:34 字数 251 浏览 0 评论 0原文

我有一个 QGraphicsView 和一个 QGraphicsScenes 幻灯片,当用户切换到下一张幻灯片时,我只需更改视图正在查看的场景,它会立即更改以反映这一点。

我想做的是创建一些过渡效果,例如旋转立方体或滑入/滑出。

然而,看看 QPropertyAnimation 类,它似乎是移动一个对象,而不是从一个对象转换到另一个对象。

就像我需要每个场景的视图,然后在每个视图之间进行转换。

我还可以采用什么其他策略?

I have a QGraphicsView and a slide show of QGraphicsScenes, at the moment when the user switches to the next slide I just change the Scene that the View is looking at and it changes instantly to reflect that.

What I would like to do it create some transition effects, such as the rotating cube or the slide in/out.

However looking at the QPropertyAnimation class it seems to be about moving an object not transitioning from one to another.

As in I would need a view for each scene and then transition between each view.

What other strategy could I employ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小糖芽 2024-10-01 11:47:34

您可以使用属性动画将图形项从单个场景滑入和滑出视图,而不是更改视图看到的场景。这将使您无需太多努力即可滑入/滑出过渡。旋转立方体效果会比较棘手,但我认为可以使用属性动画制作合理的传真。

您还可以通过子类化视图小部件并添加一些自定义属性来模拟其他效果,您可以将这些属性设置为动画并用于指导背景或前景绘制。

Instead of changing the scene that the view sees, you could use property animations to slide graphic items in and out of the view from a single scene. That would give you the slide in/out transition without too much effort. The rotating cube effect would be trickier but I think a reasonable facsimile could be produced with property animations.

You could also simulate other effects by subclassing the view widget and adding some custom properties that you could animate and use to direct background or foreground painting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文