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
x
Number: the x-coordinate.
y
Number: the y-coordinate.
z
Number: the z-coordinate (for WebGL mode).
coordinateVector
p5.Vector: the coordinate vector.
Notice any errors or typos? Please let us know. Please feel free to edit src/shape/2d_primitives.js and open a pull request!