开发者

AffineTransform linear interpolation

开发者 https://www.devze.com 2022-12-19 12:57 出处:网络
Given 2 java AffineTransform items, how can I interpolate between them. I need the image on screen to slowly move from the position/rotation/scale with one matrix applied, to the other.

Given 2 java AffineTransform items, how can I interpolate between them. I need the image on screen to slowly move from the position/rotation/scale with one matrix applied, to the other.

Preferably this should be reasonably efficient since it's running every time a game draws.

My current (really hacky) solution开发者_StackOverflow社区 is to getTranslate() from both matrices, lerp between them, and then create a new matrix (This doesn't work fully, since there is no equivalent for rotation)


Get the affine matrixes of each transform via getMatrix(). Step through the interpolation of one matrix to the other, creating a new transform via AffineTransform(float[] matrix) at each step.

0

精彩评论

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

关注公众号