Created
April 17, 2020 15:23
-
-
Save RemyPorter/ac81880055d5de4ed1eff4e0152a8df8 to your computer and use it in GitHub Desktop.
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
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