/* Tutorial de Processing Joan Soler-Adillon (www.joan.cat) Una funció ens serveix per agrupar una sèrie de línies de codi que s'executaran a l'invocar-la Això ajuda a organitzar i reciclar codi. */ void setup() { size(300, 150); smooth(); background(0); } void draw() { //res de res } void mousePressed() { //invoquem la funció per dibuixar un sputnik allí on hi ha el ratolí dibujaUnSputnik(mouseX, mouseY); } //Heus ací la funció que dibuixa un SPUTNIK: void dibujaUnSputnik(int x_, int y_) { strokeWeight(3); stroke(255); fill(255, 0, 0); line(x_-30, y_-30, x_+30, y_+30); line(x_-30, y_+30, x_+30, y_-30); ellipse(x_, y_, 35, 35); }