Skip to content

Instantly share code, notes, and snippets.

@KrabCode
Last active October 23, 2021 17:07
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/a596cf697e514276ad19e8400fd88d74 to your computer and use it in GitHub Desktop.
Save KrabCode/a596cf697e514276ad19e8400fd88d74 to your computer and use it in GitHub Desktop.
uniform sampler2D texture;
uniform vec2 resolution;
void main(void){
vec2 uv = gl_FragCoord.xy / resolution.xy;
vec3 tex = texture2D(texture, uv).rgb;
vec3 offset = vec3(-0.01, -0.01, -0.005);
tex += offset;
gl_FragColor = vec4(tex, 1.);
}
PShader feedbackShader;
float t;
void setup() {
size(1000, 1000, P2D);
background(0);
feedbackShader = loadShader("feedback.frag");
}
void draw() {
t = radians(frameCount);
translate(width / 2, height / 2);
drawRotatingRectangle(0);
filter(feedbackShader);
if (frameCount > 360 && frameCount < 720) {
//saveFrame("out2/###.jpg");
}
}
void drawRotatingRectangle(int level) {
noFill();
stroke(255);
strokeWeight(10);
rotate(t * 0.05);
rectMode(CENTER);
float size = 800;
rect(0, 0, size, size);
scale(0.889);
if (level < 30) {
drawRotatingRectangle(level + 1);
}
}
@KrabCode
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment