Skip to content
Advertisement

Flip a Bitmap image horizontally or vertically

By using this code we can rotate an image:

JavaScript

But how can we flip an image horizontally or vertically?

Advertisement

Answer

Given cx,cy is the centre of the image:

Flip in x:

JavaScript

Flip in y:

JavaScript

Altogether:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement