Drawing triangles


show more Drawing triangles provides you with in-depth training on Developer. Taught by Barton Poulson as part of the Interactive Data Visualization with Processing show less
please wait ...

Drawing triangles

The last primitive shape that we're going to use in Processing is a triangle. And what you see is that the triangle function is very similar to the quadrangle we just did. All it is, is that you specify three sets of X and Y coordinates, one pair for each of the three corners on the triangle. So the first thing I'm going to do is add the name of my file in a comment, and I'll set the size of the window, I'm doing 600 wide 200 tall, turn on the anti-aliasing and then change the background color.

I'm actually going to use a dark gray color for this one. I am using hexadecimal code, you could also use numbers on the 0 to 255 scales for these, but this is just a more compact way of doing it. And then I'm going to give a 5 pixel width to the borders by using the strokeWeight function. And then all I need to do is call triangle, this one has no abbreviation, it's just triangle and I put in three pairs of X, Y coordinates.

So in this case I'll go 150 and 50, 20...

Drawing triangles
Video duration: 2m 55s 7h 43m Beginner

Viewers:

Drawing triangles provides you with in-depth training on Developer. Taught by Barton Poulson as part of the Interactive Data Visualization with Processing

Subjects:
Developer IT
Software:
Processing
Author:
please wait ...