计算速度

发布于 2024-10-09 15:48:19 字数 177 浏览 0 评论 0原文

我试图在我的 GLSurfaceView 中实现惯性滚动,为此我需要弄清楚如何计算速度,但我不知道该怎么做。翻译存储在矩阵中,并通过下面的代码行计算。

matrix.postTranslate(event.getX() - start.x,event.getY() - start.y);

Im trying to implement inertial scrolling in my GLSurfaceView and to do that i need to figure out how to calculate velocity, but im not sure how to do so. the translation is stored in a matrix, and it is calculated by the line of code below.

matrix.postTranslate(event.getX() - start.x,event.getY() - start.y);

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

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

发布评论

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

评论(1

看春风乍起 2024-10-16 15:48:19

看一下 Scroller 和 < a href="http://developer.android.com/reference/android/view/VelocityTracker.html" rel="nofollow">VelocityTracker 类。它们一起用于在标准框架小部件中实现 fling 行为。使用这些,您的应用程序将始终与设备的本机感觉相匹配。

Take a look at the Scroller and VelocityTracker classes. Together they are used to implement fling behavior in the standard framework widgets. Use these and your app will always match the native feel of the device.

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