[Solved]HTML canvas behaving abnormally | Sololearn: Learn to code for FREE!

+4

[Solved]HTML canvas behaving abnormally

I have made a simple canvas code. But if I increase the height/width of the canvas the shapes changes their scale and behave abnormally. For example : I have a line ctx.moveTo(10, 10); ctx.lineTo(10, 20); This should create a straight line. Now if I increase the width of the canvas and re run the code the line gets longer.

4/24/2021 8:16:16 AM

Krish

6 Answers

New Answer

+4

Got the answer by Tejas Buddy https://code.sololearn.com/Wqh98ALN0h42/?ref=app

+4

Can you send your code?

+4

Canvas size and canvas element size are two different properties See: https://www.sololearn.com/post/119555/?ref=app

+3

I was just doing that Tejas ๐Ÿ˜Š๐Ÿ˜Š

+1

https://code.sololearn.com/WxQn9JoKnLxq/?ref=app