Paint processing

int count=1;
int i=5;
int j=255;
int g=10;

void setup() {
size(400, 400);
background(0, 255, 0);
}

void draw() {
if (keyPressed) {
if (key == ‘r’ || key == ‘R’) {
stroke(random(255), random(255), random(255));
}
if (key == ‘e’ || key == ‘E’) {
background(0, 255, 0);
}
if (key == ‘s’ || key == ‘S’) {
save(count+ »monBeauDessin.png »);
count++;
delay(100);
}

if (key == ‘a’ || key == ‘A’) {
strokeWeight(i);
i = i + 1;
if (i>150) {
i=i-150 ;
} }

if (key == ‘z’ || key == ‘Z’) {
stroke(0,0,0, j );
j = j – 5;
if (j < 1) {
j=j+255 ;
}}

if (key == ‘t’ || key == ‘T’) {
background(random(255), random(255), random (255));
delay(200);
}

}
if (mousePressed == true) {
strokeWeight(i);
line(pmouseX, pmouseY, mouseX, mouseY);

if (key == ‘y’) {
line( pmouseX+g, pmouseY+g, mouseX+g, mouseY+g);

}}

}

Paint avec différentes fonctionalités

r pour changer la couleur du trait de manière aléatoire

e pout revenir à l’arrière plan d’origine

a pour modifier la graisse du trait

z pour modifier la transparence du trait

t pour changer la couleur de l’arrière plan de manière aléatoire

y pour affiche un deuxième trait suivant le premier