Skip to content

Instantly share code, notes, and snippets.

@volfegan
Last active December 17, 2021 19:31
Show Gist options
  • Save volfegan/61f704ffcba702fe253190e8fc40848c to your computer and use it in GitHub Desktop.
Save volfegan/61f704ffcba702fe253190e8fc40848c to your computer and use it in GitHub Desktop.
Some parabolic Hadouken shooting fire
//https://www.youtube.com/watch?v=PqW1GOrVMS0
//https://www.dwitter.net/d/24463
//https://www.dwitter.net/d/24467
float d, t, beam, spread_wave=0;
void setup() {
size(1280, 720);
stroke(255);
noStroke();
clear();
}
void draw() {
//clear();
fill(0, 20);
rect(0, 0, width, height);
t+=.1;
if (floor(t)%20==0) beam=0;
if (beam < width+abs(spread_wave)) beam+=t;
//Red hadouken
for (int repeat_rays=50; repeat_rays>0; repeat_rays--) {
d=0;
for (int x=0; x<beam+spread_wave; x++) {
spread_wave = random(d)*random(-1, 1);
rect(x, height/2 + d, 1, 1);
d+=(random(-4, 4));
fill(255-random(1)*d, 255-pow(x, .3)*pow(d/7, 2), 255-pow(x, .3)*pow(d/3, 2));
}
}
//inner black & white rays
for (int repeat_rays=3; repeat_rays>0; repeat_rays--) {
d=0;
fill(-1);
for (int x=0; x<beam; x++) {
rect(x, height/2 + d, 1, 1);
d+=(random(-1, 1));
}
d=0;
fill(0);
for (int x=0; x<beam; x++) {
rect(x, height/2 + d, 1, 1);
d+=(random(-2, 2));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment