Created
November 20, 2014 21:45
-
-
Save darkwave/8b5259f18a4db2bf23f2 to your computer and use it in GitHub Desktop.
Snippet Lezione 3 al Fusolab 2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
size(200, 200); | |
colorMode(RGB, 256, 256, 256); //default | |
colorMode(HSB, width, 100, 100); // | |
noStroke(); //nessun bordo/tratto | |
noCursor(); | |
} | |
void draw() { | |
for (int i = 0; i < width; i++) { | |
fill(i, 100, 100); | |
rect(i, 0, 10, 100); | |
} | |
for (int i = 0; i < width; i += 10) { | |
fill( i / 10, 100, 100); | |
rect(i, 100, 10, 100); | |
} | |
color colorUnderMouse = get(mouseX, mouseY); | |
fill(colorUnderMouse); | |
ellipse(mouseX, mouseY, 50, 50); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numero; | |
int numeroB = 2; | |
float numeroCasuale = random(10); | |
numero = 10 + numeroB; | |
char lettera = 'a'; | |
String testo = "qualcosa di esempio"; | |
float numeroDecimale = 0.1; | |
int diametro = 20; | |
ellipse(50, 50, diametro, diametro); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean fallaRossa = false; | |
float diametro = random(10, 30); | |
// for(INIZIALIZZAZIONE;CONDIZIONE di USCITA;PASSO) | |
for (int i = 0; i < 10; i = i + 1) { | |
fallaRossa = !fallaRossa; | |
// if (EXPR BOOLEANA) | |
if (fallaRossa) { | |
fill(#ffff00); | |
} else if(i > 3) { | |
fill(#000000); | |
} else { | |
fill(255, 0, 255, 128); | |
} | |
ellipse(random(0, width), random(0, height), diametro, diametro); | |
println("Ciao! " + i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment