Demo Highlight: Angles
JoeStrout
Posted on December 13, 2023
Today I'd like to highlight another one of the demos that comes built-in with Mini Micro: /sys/lib/angles.ms.
This one is a little different from most of the other demos, in that it has educational value while running, rather than only while studying the code! It creates a nice interactive display that explains and illustrates angles, as measured in both radians and degrees.
Degrees are consistently shown in purple, while radians are always shown in green, to help you match up the values you see on the right with the explanations on the left.
You can click anywhere around the wumpus at upper right, or the triangle diagram at lower right, and drag the mouse to dynamically change the angle shown. The wumpus shows what that rotation looks like when applied (in degrees) to a sprite; and the triangle, plus the three values below, shows how sin
, cos
, and atan
relate the angle (in radians) to horizontal and vertical distance.
This demo will be great for younger coders who have not been taught trigonometry yet, or for anyone whose memory of those lessons may be a little rusty. Even if your trig is strong, it may still be useful. Not sure whether to use angles or degrees with a sprite rotation? Want to find exactly what angle corresponds to the "jaunty tilt" you have in mind? Fire up /sys/lib/angles and quickly find out!
If you are on a desktop machine, you can try this demo right now on the web by clicking here.
Or, if you have Mini Micro already, just fire it up and enter:
run "/sys/demo/angles"
When you're done playing around with angles, just press the Esc
or Q
key to quit. And then feel free to use the edit
command to poke at the code!
Posted on December 13, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.