Name triangle()
Example triangle(30, 75, 58, 20, 86, 75);
A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point.
Syntax triangle(x1, y1, x2, y2, x3, y3).
Below is a version of the code we used in class for the "trailing" ellipse using a triangle:
void setup() {
size(480, 120);
}
void draw() {
if (mousePressed) {
fill(0);
} else {
fill(255);
}
triangle (mouseX, mouseY, mouseX+20, mouseY, mouseX+10, mouseY-10);
}
Give it a try!
Here is a link to a hexadecimal chart to use for color.
Hex Chart Link
Replace the numbers in the fill commands with a hashtag (#) followed by the letters
or numbers of the color of your choice.
Example:
fill(#33CCFF);
That is the color aqua!
Have fun and feel free to email me at [email protected] with any questions.
Example triangle(30, 75, 58, 20, 86, 75);
A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point.
Syntax triangle(x1, y1, x2, y2, x3, y3).
Below is a version of the code we used in class for the "trailing" ellipse using a triangle:
void setup() {
size(480, 120);
}
void draw() {
if (mousePressed) {
fill(0);
} else {
fill(255);
}
triangle (mouseX, mouseY, mouseX+20, mouseY, mouseX+10, mouseY-10);
}
Give it a try!
Here is a link to a hexadecimal chart to use for color.
Hex Chart Link
Replace the numbers in the fill commands with a hashtag (#) followed by the letters
or numbers of the color of your choice.
Example:
fill(#33CCFF);
That is the color aqua!
Have fun and feel free to email me at [email protected] with any questions.
Ms. Wallace