first commit
This commit is contained in:
commit
b4fa9ed710
13 changed files with 749 additions and 0 deletions
44
Classe_ThTiming.pde
Normal file
44
Classe_ThTiming.pde
Normal file
|
@ -0,0 +1,44 @@
|
|||
public class ThTiming extends Thread {
|
||||
private boolean esecuzione;
|
||||
int r, c;
|
||||
|
||||
public ThTiming(int r, int c) {
|
||||
this.esecuzione = false;
|
||||
this.r = r;
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public void inizia(){
|
||||
this.esecuzione = true;
|
||||
this.start();
|
||||
}
|
||||
|
||||
boolean isEsecuzione() {
|
||||
return this.esecuzione;
|
||||
}
|
||||
|
||||
void run () {
|
||||
//salvo il colore iniziale
|
||||
try {
|
||||
celle[r][c].setWarningColor(color(255, 0, 0, 255));
|
||||
Thread.sleep(800);
|
||||
}catch(InterruptedException e) {
|
||||
esecuzione = false;
|
||||
}
|
||||
|
||||
while (esecuzione) {
|
||||
for(int i = 0; i<=255 && esecuzione; i += 5){
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
celle[r][c].setWarningColor(color(255, 0, 0, 255 - i));
|
||||
//println(i);
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
esecuzione = false;
|
||||
}
|
||||
}
|
||||
esecuzione = false;
|
||||
celle[r][c].setWarningColor(color(255, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue