0

I am unable to set height boundaries in javascript

I am creating bouncing ball app where bouncing hit to the boundaries and go back problem is that I am unable to define boundary for height. My width boundry working fine no issue in that but in height boundary having some issue. And I am using div element as canvas and using translate property to move the ball inside the div element. I tried different approach but not find appropriate solution. If somebody has knowledge about cordinates type app just help to solve issue and explain it Thank you. https://code.sololearn.com/Wbfa3FTW5rjc/?ref=app

27th Mar 2023, 7:01 PM
Shiv The Human Code
Shiv The Human Code - avatar
4 ответов
+ 2
Can you share your code and someone can give you a bit more specific advice?
27th Mar 2023, 7:10 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
You weren't sending the values and you have a different canvas size to the actual box. On my phone, for example, I had to add an extra 147 to make the ball stop on the bottom line. You'll see it in the code below. https://code.sololearn.com/W1DyLVMtl9EJ/?ref=app
28th Mar 2023, 7:54 AM
Ausgrindtube
Ausgrindtube - avatar
0
I shared
27th Mar 2023, 7:15 PM
Shiv The Human Code
Shiv The Human Code - avatar