Draws a single point in space.
A point's default width is one pixel. To color a point, use the stroke() function. To change its width, use the strokeWeight() function. A point can't be filled, so the fill() function won't affect the point's color.
The version of point()
with two parameters allows the point's location to be set with its x- and y-coordinates, as in point(10, 20)
.
The version of point()
with three parameters allows the point to be drawn in 3D space with x-, y-, and z-coordinates, as in point(10, 20, 30)
. Doing so requires adding the WEBGL
argument to createCanvas().
The version of point()
with one parameter allows the point's location to be set with a p5.Vector object.
Examples
Syntax
point(x, y, [z])
point(coordinateVector)
Parameters
the x-coordinate.
the y-coordinate.
the z-coordinate (for WebGL mode).
the coordinate vector.