Basic Setup
// function to call for float
float wiggle(float freq, float amp,int seed, int oct) {
float output;
float noisey;
float f = frameCount*0.01;
noiseDetail(oct);
noiseSeed(seed);
if (seed % 2 == 0 ) {
noisey = (noise(f,f)-0.5)*2;
output = ((sin(f*freq)*noisey)*amp);
} else {
noisey = (noise(f,f)-0.5)*2;
output = ((sin(f*freq)*-noisey)*amp);
}
return output;
}
// upres canvas
PGraphics canvas;
int upRes = 2; // ratio for enlargement
// setup
canvas = createGraphics(width*upRes, height*upRes);
canvas.beginDraw();
/// drawing
canvas.ellipse(x*upRes y**upRes, 2,2); // just an example
if (counter%10 == 0) { // every 10th frame we snap a preview and draws it
PImage imgcanvas = canvas.get(0, 0, canvas.width, canvas.height); //snap an image from the off-screen graphics
imgcanvas.resize(width, height); // resize to fit the on-screen display
image(imgcanvas, 0, 0); // display the resized image on screen
}
counter++;
void keyPressed() {
if (key == 's' || key == 'S') {
if (pdfsave) {
endRecord();
}
canvas.endDraw(); // finish drawing
canvas.save("export/"+filename+"/"+counter+".png");
saveFrame("export/"+filename+frameCount+extension);
}
}
index = y*width + x;
x = index % width;
y = (index - x) / width;
PImage img;
String filename = "image";
String extension = ".jpg";
String sessionid;
void settings() {
size(1024,1024);
}
void setup() {
sessionid = hex((int)random(0xffff), 4);
//resize to fit image
img = loadImage(filename + extension);
float imgR = img.width / img.height;
float sceenR = width / height;
if (sceenR > imgR) { //screen ratio is bigger than orginal image ratio
img.resize(0, height);
} else {
img.resize(0, height);
}
surface.setSize(img.width, img.height);
}
void draw() {
}
void keyPressed() {
if (key == 's' || key == 'S') {
saveFrame("export/"+filename+frameCount+extension);
}
}