Created
March 28, 2021 18:31
-
-
Save volfegan/44e45197028554f8e0e0b9d56acb8da7 to your computer and use it in GitHub Desktop.
Minimal code for screen on fire effect. Mainly due to XOR, bitwise, modulus operators.
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
//based from https://www.dwitter.net/d/21877 | |
float m, t, w=32, X, Y; | |
void setup() { | |
size(1280, 720); | |
noStroke(); | |
} | |
void draw() { | |
t+=.1; | |
fill(0, 2); | |
rect(0, 0, width, height); | |
for (int i=768; i>0; i--) { | |
fill(m=sin(int(X=i%w)>>round(random(2))^int(t*w+(Y=i/w)))*i, m/4, 0); | |
rect(X, Y, 2, 2); | |
} | |
filter(ERODE); | |
copy(this.get(), 2, 0, 30, 16, 0, 0, width, height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment