Created
August 31, 2018 22:23
-
-
Save manoloide/302f8fdcea1090552f0550471eece759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void hoja(float x, float y, float s, float ang, int col) { | |
float w = s*0.3; | |
float h = int(s); | |
pushMatrix(); | |
translate(x, y); | |
rotate(ang); | |
float pb = 0.8; | |
float px = 2.2; | |
noStroke(); | |
fill(col); | |
for (int i = 0; i < h; i++) { | |
float dx1 = sin(pow(map(i, 0, h, 0, 1), pb)*PI)*w; | |
float dx2 = sin(pow(map(i+1, 0, h, 0, 1), pb)*PI)*w; | |
float dy1 = pow(map(i, 0, h, 0, 1), px)*h; | |
float dy2 = pow(map(i+1, 0, h, 0, 1), px)*h; | |
beginShape(); | |
vertex(dx1, -i); | |
vertex(dx2, -i-1); | |
vertex(0, -dy2); | |
vertex(0, -dy1); | |
endShape(CLOSE); | |
} | |
col = lerpColor(col, color(0), 0.2); | |
for (int i = 0; i < h; i++) { | |
float dx1 = sin(pow(map(i, 0, h, 0, 1), pb)*PI)*-w; | |
float dx2 = sin(pow(map(i+1, 0, h, 0, 1), pb)*PI)*-w; | |
float dy1 = pow(map(i, 0, h, 0, 1), px)*h; | |
float dy2 = pow(map(i+1, 0, h, 0, 1), px)*h; | |
beginShape(); | |
vertex(dx1, -i); | |
vertex(dx2, -i-1); | |
vertex(0, -dy2); | |
vertex(0, -dy1); | |
endShape(CLOSE); | |
} | |
popMatrix(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment