Skip to content
Extraits de code Groupes Projets
Valider 3bea0b85 rédigé par Quentin CECCONI's avatar Quentin CECCONI
Parcourir les fichiers

Delete arc_test.pde

parent bf4d1e52
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
void setup(){
size(displayWidth,displayHeight);
background(0,0,0);
stroke(255,0,0);
noFill();
frameRate(60);
}
void slash(float a,float b,float c,float d,color col,float offset,float lastcomp, float comp){
stroke(col);
arc(a,b,c,d,lastcomp+offset,comp+offset);
if (comp <PI/2){strokeWeight(comp*5);}
if (comp > PI/2) {strokeWeight(PI/2*5 - (comp%(PI/2))*5);}
}
void mousePressed(){
is_slash = true;
comp = 0;
points = points + 1;
}
float comp = 0;
float lastcomp = 0;
float a = random(100,displayWidth);
float b = random(100,displayHeight);
float c = random(250,displayWidth);
float d = random(500,displayHeight);
float offset = random(0,2*PI);
boolean is_slash = false;
int points = 0;
void draw() {
if (is_slash == true){
slash(a,b,c,d,#FFFFFF,offset,lastcomp,comp);
slash(a+5,b+5,c,d,#FF0000,offset + PI/4,lastcomp,comp);
slash(a+10,b+10,c,d,#FFFFFF,offset + 2*PI/4,lastcomp,comp);
slash(a+15,b+15,c,d,#FF0000,offset + 3*PI/4,lastcomp,comp);
}
lastcomp = comp;
comp = comp + PI/20;
if (comp > PI){
clear();
textSize(32);
text("X"+str(points),100,100);
a = random(100,displayWidth - displayWidth/10);
b = random(100,displayHeight - displayHeight/10);
c = random(250,displayWidth-displayHeight/5);
d =random(500,displayHeight-displayHeight/5);
offset = random(0,2*PI);
is_slash =false;
comp = 0;}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter