Here I have my main canvas 2D context that is on my screen named baseCtx that is in the custum service drawingService. I want to take a rectangle that is the size of a smaller canvas that have for center my mouse. CurrentX and CurrentY are the current mousePosition on my main canvas. That is ..
I’m trying to animate a line starting from a point to another. I’d like to set an animation duration, 10 minutes for example, using a variable to pass the trip duration: let p1_x = 200; let p1_y = 200; let p2_x = 200; let p2_y = 300; let run_x = p1_x; let run_y = p1_y; ..
I am working on a game, and for that, I am trying to create a scoreboard. Right now, I have a canvas with the gameplay and want to make a second canvas to track scores. I have a few questions. First, is this possible? If so, how? I have not attempted yet, but I imagine ..
I am creating rotating planets by projecting a 200×100 bitmap on a sphere. Since this projection is costly for an animation, I hacked an array with value-pairs ["pixel address in sphere projection image", "what pixels of original bitmap goes to that address"]. To just transfer them quickly with no math. I end up with 16008 ..
I’m creating paths with new Path2D () and setting them on objects to later check with isPathInPoint(). I’m trying to create 4 circles around a box, but the circles are being connected with each draw. I know I can just create a new path each time and then push them into an array, but I ..
I’m trying to figure out how to make the keyboard get disabled after the score equals five. with everything else I’m fine. I got everything else done that I need to get done I’m just having issues with the keyboard, if I could get some help on this it would greatly be appreciated. this is ..
I am trying to create a game where I have a background, then some sprites, overlay image on top. Currently, I am able to implement them all, but when I draw the overlay image (a png), the empty space on the file automatically sets to black. If it is clear, why is it doing that? ..
i have following problem. Im trying to draw a border with notches on my buttons and slider. thats working fine. but i noticed that my diagonal lines are twice as thick as the normal ones. I saw that i have to work on the width/height settings in the canvas/tag itself. but i cant get it ..
I have just started to learn using canvas to create games and I have just started on my first one. Right now I am trying to get the square element to animate going to the mouse position after I click but I am not sure how to do that. I have tried to look all ..