Skip to content Skip to sidebar Skip to footer

Flutter CustomPainter Canvas Rotate Pivot

In my Android Studio project, I rotate the canvas simply as following canvas.rotate(angle, cx, cy); with cx and cy the center of the screen (i.e. the pivot). But in Flutter, there'

Solution 1:

canvas.translate(cx, cy);
canvas.rotate(angle);
canvas.translate(-cx, -cy);

it's possible I have lines 1 and 3 reversed. Fixed.


Post a Comment for "Flutter CustomPainter Canvas Rotate Pivot"