CirkelVorm met 5 x 4 constructors in de schets. naar de schets op open processing
Na 500 framecounts wordt de volgende setup getoond. Met de "s" toets stopt, en met de "r" toets start de animatie
de schets maakt gebruik van objecten van de class "CirkelVorm"
CirkelVorm rechthoek;
CirkelVorm rechthoek2;
CirkelVorm ellipseGeel;
CirkelVorm ellipseBlauw;
float y;
float x;
float n;
void setup() {
// size(960, 540, P3D);
fullScreen(P3D);
y = height/2;
x = width/2;
n = height/12;
setup1();
}
void setup1() {
//Argumenten van de constructor:
// 1) x positie, 2) y positie, 3) vormlengte, 4) vormbreedte, 5) cirkelstraal,
// 6) start draaihoek, 7) draaisnelheid, 8) rotatiemode, 9) aantal vormen, 10) kleur.
// rotatiemode: 1) assenstelsel, 2) x as, 3) y as, 4) Z as, dan moet de start draaihoek > 0 zijn
// 1 2 3 4 5 6 7 8 9 10
rechthoek = new CirkelVorm(x, y, 6*n, 0.1*n, 3*n, 0, -1, 1, 20, color(#FC738E));
rechthoek2 = new CirkelVorm(x, y, 3*n, 0.1*n, 3*n, 90, 1, 3, 20, color(#FC738E));
ellipseGeel = new CirkelVorm(x, y, 3*n, 2*n, 1.5*n, 0, 0, 1, 20, color(#FCF873));
ellipseBlauw = new CirkelVorm(x, y, 0.5*n, 0.5*n, 3*n, 0, 0, 1, 10, color(#73D0FC));
//stroke(0);
}
void setup2() {
rechthoek = new CirkelVorm(x,y, 3*n, 0.1*n, 3*n, 0, 3, 1, 20, color(#FC738E));
rechthoek2 = new CirkelVorm(x,y, 3*n, 0.1*n, 3*n, 45, 1, 1, 20, color(#3FBDFA));
ellipseGeel = new CirkelVorm(x,y, 3*n, 0.5*n, 3*n, 40, 0.5, 2, 10, color(#2AF78B));
ellipseBlauw = new CirkelVorm(x,y, 3*n, 0.5*n, 4*n, 90, 1, 3, 8, color(#2AF78B));
//stroke(0);
}
void setup3() { // 1 2 3 4 5 6 7 8 9 10
rechthoek = new CirkelVorm(x, y, 6*n, 0.4*n, 3*n, 0, -3, 1, 20, color(#FC527A,100));
rechthoek2 = new CirkelVorm(x, y, 6*n, 0.4*n, 3*n, 45, 0.5, 1, 20, color(#5FFC52,100));
ellipseGeel = new CirkelVorm(x, y, 6*n, 0.5*n, 3*n, 0, 1, 1, 10, color(#528CFC,100));
ellipseBlauw = new CirkelVorm(x, y, 6*n, 0.5*n, 3*n, 90, -1, 1, 20, color(#E8FC52,100));
// noStroke();
}
void setup4() {
rechthoek = new CirkelVorm(x, y, 5*n, 0.2*n, 3*n, 0, -1, 1, 20, color(#FC52A7));
rechthoek2 = new CirkelVorm(x, y, 5*n, 0.1*n, 3*n, 90, 1, 3, 20, color(#52FC6C));
ellipseGeel = new CirkelVorm(x, y, 3*n, 0.4*n, n, 0, 0, 1, 20, color(#EEFC52));
ellipseBlauw = new CirkelVorm(x, y, 3*n, 0.4*n, 3*n, 0, 0, 1, 10, color(#52A8FC));
stroke(0);
}
void setup5() { // 1 2 3 4 5 6 7 8 9 10
rechthoek = new CirkelVorm(x-6*n, y, 8*n, 0.2*n, 3*n, 45, -1, 1, 20, color(0,255,255,100));
rechthoek2 = new CirkelVorm(x-2*n, y, 8*n, 0.2*n, 3*n, 45, 0.5, 4, 20, color(255,0,0,100));
ellipseGeel = new CirkelVorm(x+2*n, y, 8*n, 0.4*n, 3*n, 90, -1, 4, 10, color(255,255,0,100));
ellipseBlauw = new CirkelVorm(x+6*n, y, 8*n, 0.4*n, 3*n, 90, 1, 4, 20, color(0,0,255,100));
// stroke(0);
}
void draw() {
background(0);
// background(#E6FBFF);
if (frameCount < 500) {
textSize(20);
fill(0,255,255);
text("key 1 = animatie 1", 10, 30);
text("key 2 = animatie 2", 10, 60);
text("key 3 = animatie 3", 10, 90);
text("key 4 = animatie 4", 10, 120);
text("key 5 = animatie 5", 10, 150);
}
textSize(15);
if (frameCount > 500 && frameCount < 1000) text("animatie 2", 5,15);
if (frameCount > 1000 && frameCount < 1500) text("animatie 3", 5,15);
if (frameCount > 1500 && frameCount < 2000) text("animatie 4", 5,15);
if (frameCount > 2000 && frameCount < 2500) text("animatie 5", 5,15);
if (frameCount == 500) setup2();
if (frameCount == 1000) setup3();
if (frameCount == 1500) setup4();
if (frameCount == 2000) setup5();
if (frameCount == 2500)
{
frameCount = 0;
setup1();
}
pushMatrix();
rechthoek.rechthoek();
popMatrix();
pushMatrix();
rechthoek2.rechthoek();
popMatrix();
pushMatrix();
ellipseGeel.ellips();
popMatrix();
pushMatrix();
ellipseBlauw.ellips();
popMatrix();
}
void keyPressed() {
if (key == 's') {
rechthoek.snelh = 0;
rechthoek2.snelh = 0;
ellipseGeel.snelh = 0;
ellipseBlauw.snelh = 0;
}
if (key == 'r') {
rechthoek.snelh = 1;
rechthoek2.snelh = 1;
ellipseGeel.snelh = 1;
ellipseBlauw.snelh = 1;
}
if (key == '5') {
frameCount = 2000;
setup5();
}
if (key == '4') {
frameCount = 1500;
setup4();
}
if (key == '3') {
frameCount = 1000;
setup3();
}
if (key == '2') {
frameCount = 500;
setup2();
}
if (key == '1') {
frameCount = 0;
setup1();
}
}