Skip to content

Instantly share code, notes, and snippets.

@RemyPorter
Created April 17, 2020 15:23
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 RemyPorter/ac81880055d5de4ed1eff4e0152a8df8 to your computer and use it in GitHub Desktop.
Save RemyPorter/ac81880055d5de4ed1eff4e0152a8df8 to your computer and use it in GitHub Desktop.
import ch.bildspur.postfx.builder.*;
import ch.bildspur.postfx.pass.*;
import ch.bildspur.postfx.*;
class Pathicle {
public Pathicle(PVector o, float r, float s, float p) {
origin = o;
phase = p;
radius = r;
speed = s;
}
PVector origin;
float phase = 0;
float radius;
public float speed;
public void draw(float t) {
float x = origin.x;
float y = origin.y;
pushMatrix();
translate(x+sin(speed*t+phase)*radius, y+cos(speed*t+phase)*radius);
noStroke();
fill(#FFFFFF);
ellipse(0, 0, 3, 3);
popMatrix();
}
}
ArrayList<Pathicle> ps = new ArrayList<Pathicle>();
PostFX fx;
void setup() {
size(640, 480, P3D);
fx = new PostFX(this);
PVector c = new PVector(width/2, height/2);
for (float x = -30; x < width+30; x+=10) {
for (float y = -30; y < height+30; y+=10) {
float d = c.dist(new PVector(x, y));
ps.add(new Pathicle(new PVector(x, y), 10, 2, d-x)); //experiment here to alter the behavior/pattern
}
}
}
float t() {
float f = frameCount;
float r = frameRate;
return f/60;
}
void draw() {
clear();
//if (frameCount > 1030) return;
noStroke();
float t = t();
for (Pathicle p : ps) {
//p.speed += sin(t)*0.005;
p.draw(t);
}
fx.render()
.rgbSplit(10)
.bloom(0.5, 20, 50)
.compose();
//saveFrame("spiral/####.tiff");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment