Created
April 10, 2014 09:28
-
-
Save Ludonaut/10361306 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
float a; | |
void setup() { | |
size(500, 500, P2D); | |
blendMode(BLEND); // also try LIGHTEST, MULTIPLY, SCREEN | |
smooth(8); | |
colorMode(HSB, 360); | |
noFill(); | |
strokeWeight(10); | |
} | |
void draw() { | |
background(100); | |
translate(width/2, height/2); | |
rotate(0); | |
float wav1 = map(sin(a), -1, 1, -12, 12); // growth | |
float wav2 = map(sin(a), -1, 1, -20, 20); // rotation | |
// 20 tris | |
for (int i = 1; i < 20; i++) { | |
float d = map(i, 1, 20, 1.0, wav1); | |
float t = map(i, 1, 20, wav2, 0.1); | |
// colors | |
float deg = map(i, 1, 20, 1, 360); | |
stroke(deg, 200, 360); | |
triangle( | |
sin(radians(i*t))*(i*d), cos(radians(i*t))*(i*d), | |
sin(radians(i*t+240))*(i*d), cos(radians(i*t+240))*(i*d), | |
sin(radians(i*t+120))*(i*d), cos(radians(i*t+120))*(i*d) | |
); | |
} | |
// TWO_PI/120 = 0.0523 | |
// instead of 0.05 for perfect loop. | |
a+=0.0523; | |
} |
Author
Ludonaut
commented
Apr 10, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment