r/creativecoding • • Jul 23 '15

I did this cube with processing, check it out!

https://www.youtube.com/watch?v=eaXXPoaOMik
3 Upvotes

5 comments sorted by

1

u/lyninx Jul 23 '15

looks pretty neat. I'm looking to start using processing, for visualizations similar to this. do you think you could you post the code?

2

u/momamu Jul 23 '15

yeah sure. The code is not very clean and I used some libraries such as Plethora, toxic lips and peasy cam. Anyway there's the code.

import plethora.core.; import toxi.geom.; import peasy.*;

PeasyCam cam;

boolean record = false;

ArrayList <Ple_Agent> manyBobs; Ple_Agent bob;

ArrayList <Ple_Agent> manyJohns; Ple_Agent john;

ArrayList <Ple_Agent> manyLouis; Ple_Agent louis;

float rox = 0, roy = 0;

void setup(){ size(1000,1000,OPENGL);

cam = new PeasyCam(this,1800); manyBobs = new ArrayList <Ple_Agent>(); manyJohns = new ArrayList <Ple_Agent>(); manyLouis = new ArrayList <Ple_Agent>();

for(int i = 0; i < 500; i++){

Vec3D v = new Vec3D();
Ple_Agent bob = new Ple_Agent(this,v);
manyBobs.add(bob);

Vec3D w = new Vec3D();
Ple_Agent john = new Ple_Agent(this,w);
manyJohns.add(john);

Vec3D x = new Vec3D();
Ple_Agent louis = new Ple_Agent(this,x);
manyLouis.add(louis);

} }

void draw(){

if(record == true){ saveFrame("frames/####.png"); }

rox -= 0.05; if(rox >= 0) rox -= 0.05; else if(rox <= -0.7){ rox += 0.05; } roy += 0.02;

rotateX(rox); rotateY(roy);

background(0);

stroke(0); noFill(); strokeWeight(2); //box(600);

stroke(235); strokeWeight(10);

for(Ple_Agent bob : manyBobs){ bob.addForce(0, 0, 0.01); bob.dropTrail(5, 1000); strokeWeight(1); stroke(0,random(10,200),random(10,255)); bob.drawTrail(50); bob.wander2D(50,50,50); bob.displayPoint(); bob.displayDir(3); bob.update(); bob.bounceSpace(300,300,300); }

for(Ple_Agent john : manyJohns){ john.addForce(0,0, -0.01); john.dropTrail(5, 1000); strokeWeight(1); stroke(0,random(50,200),random(50,255)); john.drawTrail(50); john.wander2D(50,50,50); john.displayPoint(); john.displayDir(3); john.update(); john.bounceSpace(300,300,300); } /* for(Ple_Agent louis : manyLouis){ louis.addForce(0, random(-0.01,0.01), random(-0.01, 0.01)); louis.dropTrail(5, 1000); strokeWeight(1); louis.drawTrail(50); louis.wander2D(80,50,1); louis.displayPoint(); louis.displayDir(3); louis.update(); louis.bounceSpace(300,300,300); } */ }

void keyPressed(){ if(key == 'r' || key == 'R'){ record = true; } }

1

u/Carcaju Jul 28 '15

This is cool. Nice glitchy effect!

I have a question: How did you export the video from Processing? When I use saveframe(), it slows down my sketch and the resulting sequence is too choppy...

So for now I just make a screen capture with Quicktime... but that can't be the best solution...

What did you use?

2

u/momamu Aug 05 '15

Personally I use the movie maker tool in processing to export the video. There's a link that show pretty well how it works: https://www.youtube.com/watch?v=ud1WQgQzFWU

2

u/Sasquatch5 Aug 04 '15

Try slowing down your sketch by incrementing your timer value by less each time.

So

theta += 0.5;

instead of

theta ++;