Pattern Fill
in
Programming Questions
•
3 years ago
My first post to the forum here. I have a design background but hardly any experience in programming.
int top;
int bottom;
void setup() {
size(700,700);
noStroke();
smooth();
background(255);
}
void draw() {
for (int i = 0; i < 600; i = i+100) {
for (int j = 0; j < 600; j = j+100) {
top = int(random(-25, 25));
bottom = int(random(-20, 20));
fill(int(random(0,255)),int(random(0,255)),int(random(0,255)));
triangle(80+j-bottom, 120+i, 108+j, 65+top+i, 136+j+bottom, 120+i);
}
}
noLoop();
}
To the point. I'm wondering if there is a (straight forward) way to apply patterned fills to the shapes this code generates.
int bottom;
void setup() {
size(700,700);
noStroke();
smooth();
background(255);
}
void draw() {
for (int i = 0; i < 600; i = i+100) {
for (int j = 0; j < 600; j = j+100) {
top = int(random(-25, 25));
bottom = int(random(-20, 20));
fill(int(random(0,255)),int(random(0,255)),int(random(0,255)));
triangle(80+j-bottom, 120+i, 108+j, 65+top+i, 136+j+bottom, 120+i);
}
}
noLoop();
}
So instead of random colours the fill is some kind of pattern. How are the patterns generated? Not sure. They're either generated or I make a library of tile-able images. Not sure the best route.
Thanks.
1