Pico-8 Wiki


162pages on
this wiki
Add New Page
Comments0 Share
sin( angle )

Calculates the sine of an angle.

The angle, using a full circle range of 0.0-1.0 measured clockwise (0.0 to the right).

The sin() function calculates the sine of an angle.

Pico-8 uses an input range of 0.0 to 1.0 to represent the angle, a percentage of the unit circle. An angle of π (3.1415) radians (180 degrees) corresponds to a Pico-8 angle of 0.5.

Pico-8 measures the angle in a clockwise direction, with 0.0 to the right, 0.25 downward, and so on. This is inverted from the convention used in traditional geometry, though the inversion only affects sin(), not cos().

Pico8sincos v2

The inversion is useful because Pico-8's screen (like most graphics engines) uses inverted y coordinates: an increase in y goes downward. Many uses of sin() would need to be inverted anyway, so Pico-8 does it by convention.

(The clockwise direction of the angle is equivalent to going counterclockwise and negating sin(). This is how it is described in the official documentation.)

Examples Edit

for t=0,1,0.125 do
  print('sin('..t..') = '..sin(t))


sin(0) = 0
sin(0.125) = -0.7071
sin(0.25) = -1
sin(0.375) = -0.7071
sin(0.5) = 0
sin(0.625) = 0.7071
sin(0.75) = 1
sin(0.875) = 0.7071
sin(1) = 0

See also Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.