开发者

calculating velocity

开发者 https://www.devze.com 2023-02-02 09:04 出处:网络
Im trying to implement inertial scroll开发者_JS百科ing 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 m

Im trying to implement inertial scroll开发者_JS百科ing 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);


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消