Skip to content

Instantly share code, notes, and snippets.

@KrabCode
Last active April 2, 2024 13:57
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 KrabCode/4c12435e025068f1103d8f3ccecdcc59 to your computer and use it in GitHub Desktop.
Save KrabCode/4c12435e025068f1103d8f3ccecdcc59 to your computer and use it in GitHub Desktop.
import ch.bildspur.postfx.builder.*;
import ch.bildspur.postfx.pass.*;
import ch.bildspur.postfx.*;
import org.gicentre.handy.*;
import com.krab.lazy.*;
PostFX fx;
LazyGui gui;
HandyRenderer hr;
PImage img;
float w, h, t;
void setup() {
size(800, 800, P2D);
img = loadImage("https://i.imgur.com/BLlT0F7.png");
fx = new PostFX(this);
gui = new LazyGui(this, new LazyGuiSettings().setLoadLatestSaveOnStartup(true));
hr = new HandyRenderer(this);
}
void draw() {
w = width;
h = height;
t = radians(frameCount);
background(gui.colorPicker("bg", color(36)).hex);
drawRays();
drawCircle();
postFx();
drawImage();
if (frameCount > 1 && frameCount <= 361) {
save("out_holiest_pepe/" + frameCount + ".jpg");
}
}
void drawImage() {
gui.pushFolder("img");
pushMatrix();
translate(w/2, h/2);
PVector pos = gui.plotXY("pos", 0, 0);
float scale = gui.slider("scale", 1);
translate(pos.x, pos.y);
scale(scale);
imageMode(CENTER);
image(img, 0, 0);
popMatrix();
gui.popFolder();
}
void drawRays() {
gui.pushFolder("rays");
pushMatrix();
translate(w/2, h/2);
PVector pos = gui.plotXY("pos");
translate(pos.x, pos.y);
hr.setSeed(floor(frameCount * gui.slider("speed", 0.1)));
hr.setStrokeWeight(gui.slider("weight", 3));
stroke(gui.colorPicker("stroke", color(255)).hex);
float r0 = gui.slider("radius base", 150);
float rAmp = gui.slider("radis base amp", 5);
int rayCount = gui.sliderInt("ray count", 32);
float rayLengthBase = gui.slider("len base", 100);
float rayLengthAmp = gui.slider("len amp", 34);
float rayLengthFreq = gui.slider("len freq", 100);
for (int i = 0; i < rayCount; i++) {
float iNorm = norm(i, 0, rayCount);
float theta = iNorm * TAU;
pushMatrix();
rotate(theta);
float n = sin(iNorm * rayLengthFreq * TAU + t);
hr.line(r0 + rAmp * n, 0, r0 + rayLengthBase + rayLengthAmp * n, 0);
popMatrix();
}
popMatrix();
gui.popFolder();
}
void drawCircle() {
gui.pushFolder("circle");
pushMatrix();
translate(w/2, h/2);
PVector pos = gui.plotXY("pos");
translate(pos.x, pos.y);
float radius = gui.slider("radius", 250);
stroke(gui.colorPicker("stroke", color(255)).hex);
noFill();
hr.setSeed(floor(frameCount * gui.slider("speed", 0.1)));
hr.setStrokeWeight(gui.slider("weight", 3));
hr.ellipse(0, 0, radius, radius);
popMatrix();
gui.popFolder();
}
void postFx() {
gui.pushFolder("fx");
imageMode(CORNER);
fx.render()
.bloom(gui.slider("threshold", 0.5), gui.sliderInt("blur size", 20), gui.slider("sigma", 30))
.compose();
gui.popFolder();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment