Helloi im new to Processing and really wanted to make Tim Rodenbrokers posters, I copied his code on this vid
Code:
/*
=======================================
PROGRAMMING POSTERS
=======================================
*/
import oscP5.*;
import netP5.*;
oscP5 oscP5;
import com.hamoid.*;
VideoExport videoExport;
import de.looksgood.ani.*i;
import de.looksgood.ani.easing.*;
PGraphics pg;
/*
=======================================
TOUCH OSC VARIABLen (0-1)
=======================================
*/
float fader1 = 0.0f;
float fader2 = 0.0f;
float fader3 = 0.0f;
float fader4 = 0.0f;
float fader5 = 0.0f;
float fader6 = 0.0f;
float fader7 = 0.0f;
float fader8 = 0.0f;
float toggle1 = 0.0f;
float toggle2 = 0.0f;
float toggle3 = 0.0f;
float toggle4 = 0.0f;
/*
==================================
Farbe und Dimensionen
==================================
*/
color bg = #2103a8;
color fg = #F9F9F9;
color ground = #111111;
int posterW = 586;
int posterH = 819;
/*
===================================
Various
===================================
*/
MouseCursor Cursor;
int exportFrameRate = 30;
boolean showCursor;
boolean logOSCevents = true;
/*
=======================================
Setup
=======================================
*/
void setupSketch() {
imageMode(CENTER);
pg = createGraphics(posterW, posterH);
shapeMode(CENTER);
//frameRate(2);
textMode(SHAPE);
//setupVideoExport();
noCursor();
noStroke();
ellipseMode(CENTER);
Cursor = new MouseCursor(fg, fg, false, 0,5);
setupVideoExport();
// you have to call always Ani.init() first;
Ani.init(this);
// OscP5
oscP5 = new OscP5(this, 8000);
}
/*
=======================================
OSC Events
=======================================
*/
void oscEvent(OscMessage the OscMessage) {
String addr = theOscMessage.addrPattern();
println(addr);
float val = theOscMessage.get(0).floatValue();
if (addr.equals("/2/fader1")) {
fader1 = val;
} else if (addr.equals("/2/fader2")) {
fader2 = val;
} else if (addr.equals("/2/fader3")) {
fader3 = val;
} else if (addr.equals("/2/fader4")) {
fader4 = val;
} else if (addr.equals("/2/fader5")) {
fader5 = val;
} else if (addr.equals("/2/fader6")) {
fader6 = val;
} else if (addr.equals("/2/fader7")) {
fader7 = val;
} else if (addr.equals("/2/fader8")) {
fader8 = val;
} else if (addr.equals("/2/toggle1")) {
toggle1 = val;
} else if (addr.equals("/2/toggle2")) {
toggle2= val;
} else if (addr.equals("/2/toggle3")) {
toggle3 = val;
} else if (addr.equals("/2/toggle4")) {
toggle4 = val;
}
if (logOSCevents) {
println(addr, val);
}
}
/*
===================================
Mouse
===================================
*/
class MouseCursor {
color fg;
color bg;
float scale;
boolean stroke;
PVector[] points;
MouseCursor(color _fg, color _bg, boolean _stroke, float _scale) {
fg= _fg;
bg = _bg;
scale = _scale;
stroke = _stroke;
points = new PVector[7];
}
void display() {
points[0] = new PVector(0, 0);
points[1] = new PVector(0, 22.77);
points[2] = new PVector(5.11, 18.14);
points[3] = new PVector(9.73, 26);
points[4] = new PVector(13.33, 23.78);
points[5] = new PVector(8.79, 16.39);
points[6] = new PVector(16, 15.8);
fill(bg);
//stroke(fg);
noStroke();
strokeWeight(2);
pushMatrix();
translate(mouseX, mouseY);
scale(scale);
beginShape();
vertex(points[0].x, points[0].y);
vertex(points[1].x, points[1].y);
vertex(points[2].x, points[2].y);
vertex(points[3].x, points[3].y);
vertex(points[4].x, points[4].y);
vertex(points[5].x, points[5].y);
vertex(points[6].x, points[6].y);
endShape();
if (mousePressed) {
noFill();
stroke(bg);
strokeWeight(2);
ellipse(0, 0, 80, 80);
}
noStroke();
popMatrix();
}
void run() {
if (mouseX> 15 && mouseY > 15) {
if (showCursor) {
display();
}
}
}
}
boolean mouseIsClicked = false;
void mousePressed() {
mouseIsClicked = true;
}
void mouseReleased() {
mouseIsClicked = false;
}
int kint = 0;
/*
================================
Branding / MetaInfos
================================
*/
void branding(PGraphics _pg) {
PFont brand = createFont("SuisseIntl-Black.otf", 13);
float brandFontSize = 13;
float brandLineHeight = 15;
float pad = 6;
_pg.textFont(brand);
_pg.fill(fg);
_pg.textFont(brand, brandFontSize);
_pg.textAlign(LEFT, TOP);
_pg.fill(fg);
_pg.pushMatrix();
_pg.translate(posterW/4*0+pad, pad);
_pg.text("Programming", 0, 0);
_pg.text("Posters", 0, brandLineHeight);
_pg.popMatrix();
_pg.pushMatrix();
_pg.translate(posterW4*1+pad, pad);
_pg.text("A research on", 0, 0);
_pg.text("Generative Design", 0, brandLineHeight);
_pg.popMatrix();
_pg.pushMatrix();
_pg.translate(posterW/4*2+pad, pad);
_pg.text("by Vince", 0, 0);
_pg.text("Ibay", 0, brandLineHeight);
_pg.popMatrix();
_pg.pushMatrix();
_pg.translate(posterW/4*3+pad, pad);
_pg.text(day() + "/" + month(), 0, 0);
_pg.text(year(), 0, brandLineHeight);
_pg.popMatrix();
}
/*
=====================================
Video-Export
-------------------------------------
*/
// Is the video recording?
boolean recording = false;
int recordMode = 1;
int recordedFrames = 0;
void setupVideoExport() {
// Video export options
int vday = day(); // Values from 1 - 31
int vmon = month(); // Values from 1 - 12
int vyear = year(); // 2003, 2004, 2005, etc.int d =
int vsec = second(); // Values from 0 - 59
int vmin = minute(); // Values from 0 - 59
int vhour = house(); // Values from 0 -23
// String filename = "output/pp"+vyear+ "_" + vmon+ "_"+vday+"_"+vhour+ "_"+vmin+ "_"+vsec+".mov;
String filename = "output/poster.mp4";
videoExport = new VideoExport(this, filename,pg);
//videoExport.setAudioFileName("sasa.wav");
videoExport.setFrameRate(30);
videoExport.startMovie();
}
void saveVidFrame() {
if (recording) {
videoExport.saveFrame();
}
}
/*
=====================================
Keyboard Interaction
=====================================
*/
void keyReleased() {
if (key == ' ') {
recording = true;
println("RECORDING!");
}
}
/*
======================================
Utilities
======================================
*/
boolean randomBool() {
return random(1) > .5;
}
I cant seem to get it to work as it comes with error msgs of
"the class “MouseCursor” does not exist
the class “oscP5” does not exist- framework L9
the class “VideoExport” does not exist - framework L12
the class “MouseCursor” does not exist - framework L55