I was wondering about the move () steps block

I was wondering bc i wanted to make one in html, (i feel like it involves math, so...)
How could i make the move (?) Steps effect in the browser x/y system and in the math also how?
And i know this has nothing to do with snap but it sorta does.

x += Math.cos(direction)
y += Math.sin(direction)
For these to work, direction must be in radians (if it is in degrees, replace it with direction * Math.PI / 180) and 0 is to the right and increases counterclockwise.

Advanced Topics

I was taught (by William Kahan, who invented the IEEE floating point standard) that if you're translating degrees to radians you first have to get the angle into the range [0,45], which may involve one or more of changing the sign of the input, changing the sign of the output, changing sin to cos or vice versa, or of course taking the angle mod 360. Otherwise you can get inaccuracies in the last digit.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.