html - How to resize canvas and its background image while somehow maintaining the co-ordinate scale? -
i want canvas , background image scale browser size have learnt possible through this.
<canvas id="canvas" style="width:100%; height:100%; background-size:100% 100%; left:0px; top: 0px;">
setting width , height using percentages causes whatever draw on top come out blurred. reason read comes out blurry because width , height of canvas set using css different.
it absolutely imperative keep track of co-ordinates since have written collision detection logic using original size of image.
is possible dynamically change canvas size fill screen, redraw , ensure collision logic works without blurry drawing on top?
lets take example here. image floor.jpg want background of canvas 1200x700. want canvas 100% of page width , height. animated player moves on top of requires collision detection walls have coded keeping in mind 1200x700 image.
i have gone through various similar question on site, can't seem figure out.
Comments
Post a Comment