Created
May 14, 2022 18:42
-
-
Save tonetheman/d9730df34db498ec8af4d1d6d2073d1a to your computer and use it in GitHub Desktop.
interesting processing i saw on twitter lost the link though :(
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
int n=200,i,s,t; | |
float a[] = new float[n*4],d; | |
void setup() { | |
size(800,800); | |
colorMode(3); | |
blendMode(2); | |
for(i=0;i<n*4;i++) { | |
a[i] = 400-random(800); | |
} | |
} | |
void draw() { | |
clear(); | |
noStroke(); | |
noFill(); | |
for(i=0;i<n;i++) { | |
for(s=i;s<n;s++){ | |
for(t=s;t<n;t++){ | |
if((d=dist(a[i],a[i+n],a[s],a[s+n]))<99 && | |
dist(a[i],a[i+n],a[t],a[t+n])<99){ | |
fill((i+s+t)%255,255,255,999/d); | |
triangle(a[i],a[i+n],a[s],a[s+n],a[t],a[t+n]); | |
a[i]+=a[i+n*2]/5e3; | |
a[i+n]+=a[i+n*3]/5e3; | |
if(abs(a[i])>400) { | |
a[i+n*2]*=-1; | |
} | |
if(abs(a[i+n])>400) { | |
a[i+n*3]*=-1; | |
} | |
} // end of if | |
} // end of for loop t | |
} // end of for loop s | |
} // end of for loop i | |
} // end of draw | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment