Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73845

How do i make a path on a canvas (HTML5) move a a certain angle

$
0
0

I have a path that is a triangle and i am trying to move it forward a certain length at a specific angle,

this.x += length*Math.sin(this.angle); 
this.y -= -length*Math.cos(this.angle);

length is the amount of distance forward and angle is the angle at which the path is facing. When i run it, and the angle is 90 degrees it moves on the x correctly but changes the y.

image


Viewing all articles
Browse latest Browse all 73845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>