Hi!
Thanks for the tips! I tried to recreate the gradients from Ben Fry's Revisionist, like this:
Code:
void setup() {
size(600, 600);
stroke(255);
background(255, 255, 255);
}
void draw() {
int x1 = 10;
int x2 = width - x1;
int y1 = height - x1 - 20;
int y2 = x1;
// first one without gradient
stroke(0, 128, 0);
fill(0, 128, 0, 128);
beginShape();
vertex(x1, y1);
bezierVertex(x1+250, y1, x2-450, y2, x2, y2);
vertex(x2, y2+100);
bezierVertex(x2-450, y2+100, x1+250, y1+5, x1, y1+5);
vertex(x1, y1);
endShape();
// Second one with gradient
y1 = y1 + 10;
y2 = y2 + 120;
PGraphics pgGradient = createGraphics(width, height, P2D);
PGraphics pgMask = createGraphics(width, height, P2D);
pgGradient.beginDraw();
pgGradient.strokeWeight(1);
color cFrom = color(70, 150, 76);
color cTo = color(255, 255, 255);
for (int i = 0; i < pgGradient.width; i++){
pgGradient.stroke(lerpColor(cFrom, cTo, (float)i/pgGradient.width));
pgGradient.line(i, 0, i, pgGradient.height);
}
pgGradient.endDraw();
pgMask.background(0);
pgMask.fill(255);
pgMask.stroke(255);
//pgMask.noStroke();
pgMask.beginDraw();
pgMask.beginShape();
pgMask.vertex(x1, y1);
pgMask.bezierVertex(x1+250, y1, x2-450, y2, x2, y2);
pgMask.vertex(x2, y2+100);
pgMask.bezierVertex(x2-450, y2+100, x1+250, y1+5, x1, y1+5);
pgMask.vertex(x1, y1);
pgMask.endShape();
pgMask.endDraw();
pgGradient.mask(pgMask.get(0,0,pgMask.width, pgMask.height));
image(pgGradient, 0, 0);
noLoop();
}
Is this how you think he did it?
Thanks!