//import ddf.minim.*;
//import ddf.minim.analysis.*;
//import ddf.minim.effects.*;
//import ddf.minim.signals.*;
//import ddf.minim.spi.*;
//import ddf.minim.ugens.*;
//Minim minim;
//AudioPlayer song;
//BeatDetect beat;
//BeatListener bl;
//float kickSize, snareSize, hatSize;
float speed = 0.003f;
float radius1;
float radius2;
color b = color(0);
int sketchToDraw;
void setup() {
size(600, 600, P3D);
smooth();
background(0); //0xeeeeff
//minim = new Minim(this);
//song = minim.loadFile("Kintsugi (09_04_20).mp3", 1024);
//song.play();
}
void draw() {
background(b);
//if(song==null)
//return;
switch (sketchToDraw) {
case 0: draw1(); break;
case 1: draw2(); break;
case 2: draw3(); break;
default:
b = color(0, 255, 0);
draw0();
break;
}
}
void keyPressed() {
if (key == '1')
sketchToDraw = 0;
else if (key == '2')
sketchToDraw = 1;
else if (key == '3')
sketchToDraw = 2;
else
sketchToDraw = '!';
}
//////////////////////// other sketches / scenes in tabs below: draw1(), draw2(), draw3()
//// that I call from draw() using switch
void draw0()
{
println("Hit a key 1 or 2 or 3 ...");
}
void draw1() {
b = color(255, 0, 255);
println("1");
speed = 0.003f;//0.03f;
radius1 = 50 + 30 * sin( frameCount * speed);
radius2 = 50 +30 * cos(frameCount * speed);
if (mousePressed) {
background(255);
//filter(ERODE);
filter(INVERT);
strokeWeight(100 * sin(frameCount * speed));
stroke(#81FFE0, 255); //255
fill(0, 0);
rotateX(radians(radius1));
} else {
strokeWeight(sin(frameCount * speed));
stroke(#81FFE0, random(100, 200));
fill(255, radius1, radius2, 3);
}
pushMatrix();
//frameRate(30);
//background(0);
lights();
translate(width/2, height/2, 200);
rotateZ(radians(radius2));
rotateX(PI * sin(radians(radius1*500)));
rotateY(radians(radius2 * speed));
//println(sp);
sphere(constrain(radius2*3, 20, 1000)); //1000
//ellipse(mouseX, mouseY, radius1 * 15, radius2 * 15);
popMatrix();
pushMatrix();
lights();
translate(width/2, height/2, 200);
rotateY(radius1 * 500);
rotateZ(radius2 * 1000);
sphere(800);
popMatrix();
}
void draw2() {
println("2");
b = color(255, 255, 0);
speed = 0.003f;//0.03f;
radius1 = 50 + 30 * sin( frameCount * speed);
radius2 = 50 +30 * cos(frameCount * speed);
if (mousePressed) {
background(255);
filter(ERODE);
//filter(INVERT);
strokeWeight(10 * sin(frameCount * speed));
stroke(#81FFE0, 150); //255
fill(0, 255);
rotateX(radians(radius1));
} else {
strokeWeight(sin(frameCount * speed));
stroke(#81FFE0, random(100, 200));
fill(255, radius1, radius2, 3);
}
pushMatrix();
// frameRate(30);
//background(0);
lights();
translate(width/2, height/2, 200);
rotateZ(radians(radius2));
rotateX(PI * sin(radians(radius1*500)));
rotateY(radians(radius2 * speed));
//println(sp);
sphere(constrain(radius2*3, 20, 1000)); //1000
pushStyle();
filter(POSTERIZE,230); // FILTER!!!
popStyle();
//ellipse(mouseX, mouseY, radius1 * 15, radius2 * 15);
popMatrix();
pushMatrix();
lights();
translate(width/2, height/2, 200);
rotateY(radius1 * 500);
rotateZ(radius2 * 1000);
sphere(800);
popMatrix();
}
void draw3() {
println("3");
b = color(255, 0, 0);
speed = 0.003f;//0.03f;
radius1 = 50 + 30 * sin( frameCount * speed);
radius2 = 50 +30 * cos(frameCount * speed);
if (mousePressed) {
background(255);
filter(ERODE);
//filter(INVERT);
strokeWeight(100 * sin(frameCount * speed));
stroke(#81FFE0, 255); //255
fill(0, 0);
rotateX(radians(radius1));
} else {
strokeWeight(sin(frameCount * speed));
stroke(#81FFE0, random(100, 200));
fill(255, radius1, radius2, 3);
}
pushMatrix();
//frameRate(30);
//background(0);
lights();
translate(width/2, height/2, 200);
rotateZ(radians(radius2));
rotateX(PI * sin(radians(radius1*500)));
rotateY(radians(radius2 * speed));
//println(sp);
sphere(constrain(radius2*3, 20, 1000)); //1000
//ellipse(mouseX, mouseY, radius1 * 15, radius2 * 15);
popMatrix();
pushMatrix();
lights();
translate(width/2, height/2, 200);
rotateY(radius1 * 500);
rotateZ(radius2 * 1000);
sphere(800);
popMatrix();
}