How to keep sprite size wheen canvas height change



Edit fiddle - JSFiddle - Code Playground

Hi!
As an option, save the window initial height into a variable, then in the animation loop divide it with the window current height, thus you’ll get the scale that you can apply to the sprite.

Example: Edit fiddle - JSFiddle - Code Playground

1 Like