本文介绍了AnimationTimer如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 AnimationTimer 类文档中的引用。

但是我不知道有多少帧每秒渲染一次,何时调用handle方法?在帧渲染之前或之后。

But I don't know how many frames are rendered each second, and when the handle method has been called ? before frame being rendered or after.

在我的应用程序中使用太多 AnimationTimer 是个坏主意吗(游戏)?

And is it bad idea to use too many AnimationTimer in my application(Game)?

推荐答案

javafx渲染多少帧取决于您程序的复杂性。上限约为每秒60帧,这是应用程序的常见fps边界。在显示帧之前调用该方法(您可以通过在方法中简单地插入一个断点来进行检查)。

How many frames javafx renders depends on the complexity of your program. The cap is at approx. 60 frames per second, which is a common fps border for applications. The method is called prior to the frame being displayed (you can check that by simply putting a breakpoint into the method).

实际上,它是AnimationTimer的常用用法计算每秒的帧数。该博客条目对很多内容进行了解释:

Actually, it is a common use for the AnimationTimer to count the frames per second. This blog entry explains a lot:

AnimationTimer可以是用于广泛的应用程序,而不仅仅是动画。如果不查看代码本身,就无法确定用于特定应用程序是个好主意。但对于使用AnimationTimer来说,这是一个很好的阅读来源:

The AnimationTimer can be used for a wide range of applications, not just for animations. If it is a good or bad idea to use for your specific application cannot be determined without seeing the code itself. but for usages of AnimationTimer, this is a good source to read:

这篇关于AnimationTimer如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 10:35