2D
These pages explain how to use the 2D primitives in the library
Last updated
These pages explain how to use the 2D primitives in the library
Last updated
In 2D mode, shapes are defined by a sequence of vertices that are then connected into edges to form a closed region.
The region can be filled with any color using fill(), and the edges can be colored using stroke().
Some shapes have a known configuration of vertices (for example, we all know what the vertices of a square look like), and this gives us an advantage to use other simpler information (like the center of the square, and the length of its sides), and from that, we can calculate all the other vertices.
Shapes like circle(), ellipse(), arc(), square(), rect() offer that shortcut. You can always resort to using beginShape(), triangle(), or quad().
Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!
We'd love to hear your Feedback/Comments here.
beginShape() - General Polygon