Last active
May 27, 2021 23:19
-
-
Save volfegan/8d04643793c1a3a5e8479dad949d5684 to your computer and use it in GitHub Desktop.
Simple pseudo3D twister effect in vertical bar with 2 colours
This file contains hidden or 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
//https://www.dwitter.net/d/20135 | |
//https://democyclopedia.wordpress.com/2015/11/29/t-comme-twister/ | |
//more info: | |
//http://eab.abime.net/showthread.php?t=59865&page=5 | |
float b, d, n, m, r, t; | |
void setup() { | |
size(1280, 720); | |
noStroke(); | |
} | |
void draw() { | |
clear(); | |
t+=.01; | |
t%=92.2; | |
for (float y=height; y>0; y-=2) { | |
d=twister(r=y/255,r); | |
//d=cos(r)-sin(r); //simple Twist | |
for (float i=4; i>0; i--) { | |
//uniform rotation | |
//n=twister(i, r); | |
//m=twister(i+1, r); | |
//more wild rotations | |
n=twister(i, r*cos(t*constrain(tan(t*.1),-PI/4,PI/4))); | |
m=twister(i+1, r*cos(t*constrain(tan(t*.1),-PI/4,PI/4))); | |
b=255*(m-n)/70; | |
fill(i%2==0?0:b/2, 255-i%2==0?0:b/3, i%2==0?b:0); | |
if (n<m) rect(n+d+width/2, y, m-n, 2); | |
} | |
} | |
} | |
float twister(float I, float r) { | |
return sin(t*3+r+I*1.57)*60; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment