Im drawing a bitmap at a canvas. Im trying to have this bitmap rotate and change position.
For that im using this code:
matrix.setTranslate(pos_x, 15);
matrix.setRotate(30);
canvas.drawBitmap(bitmap, matrix,paint);
And all this is in a loop so the variable “pos_x” will be increased.
But it seems like matrix wont accept both of these lines, setTranslate and setRotate.
The bitmap is rotated when i comment out the setTranslate. And the bitmap is moving when i comment out the rotate. But they won’t work together!
What should I do?
Thanks!
The problem most likely is in the meaning of the word ‘set’.
Instead of setting aka overwriting the matrix, one should incrementally adjust it:
either should one first setTranslate and then Rotate, or setRotate and then Translate.