How it works: Up and Down Keys change the rings; Left and Right Keys move clockwise and anticlockwise.
To complete the puzzle you have to analyze the constraints.
CODE ______________________________________________________________________________
PImage cerc1;
PImage cerc2;
PImage cerc3;
PImage cerc4;
PImage cerc5;
PImage sfondo;
float counter;
float counter2;
float counter3;
float counter4;
float pippo1;
float pippo2;
float pippo3;
float pippo4;
int cerc=1;
float alpha=0;
void setup(){
size (1000,500);
counter=0.0;
counter2=0.0;
counter3=0.0;
counter4=0.0;
pippo1=0.0;
pippo2=0.0;
pippo3=0.0;
pippo4=0.0;
cerc1= loadImage("cerchio1-03.png");
cerc2= loadImage("cerchio2-04.png");
cerc3= loadImage("cerchio3-05.png");
cerc4= loadImage("cerchio4-06.png");
cerc5= loadImage("cerchio5-07.png");
sfondo= loadImage("sfondo-02.png");
//translate(500,250);
}
void draw(){
background(0);
imageMode(CENTER);
translate(500,250);
image(sfondo, 0, 0,1000,500);
image(cerc1,0,0,90,90);
if (cerc>4)cerc=1;
if (cerc<1)cerc=4;
println(cerc);
////////////////////////////////
///////////////////////////////
if (cerc == 2) {
pippo2+=alpha;
pippo1-=alpha/2;
tint(255, 255);
}
rotate(pippo2);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc3,0,0,270,270);
tint(255, 200);
rotate(-pippo2);
if (cerc == 1) {
pippo1+=alpha;
tint(255, 255);
}
rotate(pippo1);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc2,0,0,180,180);
tint(255, 200);
rotate(-pippo1);
///////////////////////////////
if (cerc == 3) {
pippo3+=alpha;
pippo4-=alpha*2/3;
tint(255, 255);
}
rotate(pippo3);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc4,0,0,360,360);
tint(255, 200);
rotate(-pippo3);
///////////////////////////////
if (cerc == 4) {
pippo4+=alpha;
tint(255, 255);
}
rotate(pippo4);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc5,0,0,450,450);
tint(255, 200);
rotate(-pippo3);
}
void keyPressed() {
if (keyCode == UP){
cerc--;
}
if (keyCode == DOWN){
cerc++;
}
if (keyCode == LEFT){
alpha = PI/12;
}
if (keyCode == RIGHT){
alpha = -PI/12;
}
}
void keyReleased() {
alpha=0;
}
PImage cerc2;
PImage cerc3;
PImage cerc4;
PImage cerc5;
PImage sfondo;
float counter;
float counter2;
float counter3;
float counter4;
float pippo1;
float pippo2;
float pippo3;
float pippo4;
int cerc=1;
float alpha=0;
void setup(){
size (1000,500);
counter=0.0;
counter2=0.0;
counter3=0.0;
counter4=0.0;
pippo1=0.0;
pippo2=0.0;
pippo3=0.0;
pippo4=0.0;
cerc1= loadImage("cerchio1-03.png");
cerc2= loadImage("cerchio2-04.png");
cerc3= loadImage("cerchio3-05.png");
cerc4= loadImage("cerchio4-06.png");
cerc5= loadImage("cerchio5-07.png");
sfondo= loadImage("sfondo-02.png");
//translate(500,250);
}
void draw(){
background(0);
imageMode(CENTER);
translate(500,250);
image(sfondo, 0, 0,1000,500);
image(cerc1,0,0,90,90);
if (cerc>4)cerc=1;
if (cerc<1)cerc=4;
println(cerc);
////////////////////////////////
///////////////////////////////
if (cerc == 2) {
pippo2+=alpha;
pippo1-=alpha/2;
tint(255, 255);
}
rotate(pippo2);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc3,0,0,270,270);
tint(255, 200);
rotate(-pippo2);
if (cerc == 1) {
pippo1+=alpha;
tint(255, 255);
}
rotate(pippo1);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc2,0,0,180,180);
tint(255, 200);
rotate(-pippo1);
///////////////////////////////
if (cerc == 3) {
pippo3+=alpha;
pippo4-=alpha*2/3;
tint(255, 255);
}
rotate(pippo3);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc4,0,0,360,360);
tint(255, 200);
rotate(-pippo3);
///////////////////////////////
if (cerc == 4) {
pippo4+=alpha;
tint(255, 255);
}
rotate(pippo4);
//blend(cerc5, 300, 300, 0, 0, 300, 300, 0, 0,EXCLUSION);
image(cerc5,0,0,450,450);
tint(255, 200);
rotate(-pippo3);
}
void keyPressed() {
if (keyCode == UP){
cerc--;
}
if (keyCode == DOWN){
cerc++;
}
if (keyCode == LEFT){
alpha = PI/12;
}
if (keyCode == RIGHT){
alpha = -PI/12;
}
}
void keyReleased() {
alpha=0;
}