Skip to content

Instantly share code, notes, and snippets.

@Ludonaut
Created April 10, 2014 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ludonaut/10361306 to your computer and use it in GitHub Desktop.
Save Ludonaut/10361306 to your computer and use it in GitHub Desktop.
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;
}
@Ludonaut
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment