The Coordinate System

x/y

In p5.js the coordinate system starts in the upper left corner. This is the point where x = 0 and y = 0. The x axis increases to the right. The y axis increases downwards. We can draw a dot using the command point(x,y) at that location.

In the plot above you see the coordinate system as used by default in p5.js and three dots.

Sketch

In this sketch we draw three points. A darkgrey one at x = 10 and y = 10, a gold one at 50, 50 (remember first parameter for the point function is x, the second y) and a blueviolet one at a random position on the canvas.

A point has no volume or area as we could call it. Therefore we can only change its color using the stroke method. The strokeWeight method can be used to change its size.

Tasks

Referenced Methods

See the p5.js reference to learn more about the used methods.