Outils pour utilisateurs

Outils du site


informatique:processing:closed_lines

ClosedLine

from http://jmartinho.net/digitalArt-html5/index.php?art=closedLine

// JOAO MARTINHO MOURA //
// www.jmartinho.net //
// //
int tamanhoWIDTH = 950;
int tamanhoHEIGHT = 500;
int numeroPontos = 200;
int[] NumerosArrayX = new int[numeroPontos];
int[] NumerosArrayY = new int[numeroPontos];
int[] RND_NumerosArrayX = new int[numeroPontos];
int[] RND_NumerosArrayY = new int[numeroPontos];
int contaMouse=0;
void setup() {
 frameRate(20);
 background(255,255,255);
 size(tamanhoWIDTH, tamanhoHEIGHT);
 for (int i = 0; i < numeroPontos; i++) {
  NumerosArrayX[i] = tamanhoWIDTH/2;
  NumerosArrayY[i] = tamanhoHEIGHT/2;
 }
 for (int i = 0; i < numeroPontos; i++) {
  RND_NumerosArrayX[i] = tamanhoWIDTH/2;
  RND_NumerosArrayY[i] = tamanhoHEIGHT/2;
 }
}

void draw() { fill(255,255,255,50); noStroke rect(0,0,width,height); stroke(0) contaMouse ++; if (contaMouse < numeroPontos){ NumerosArrayX[contaMouse] = mouseX; NumerosArrayY[contaMouse] = mouseY; RND_NumerosArrayX[contaMouse] = mouseX + int(random(-10,10)); RND_NumerosArrayY[contaMouse] = mouseY + int(random(-10,10)); }else{ contaMouse=0; } for (int i = 0; i < numeroPontos; i ++) { if (i>0){ stroke(10,10,10,20); line(RND_NumerosArrayX[i],RND_NumerosArrayY[i],RND_NumerosArrayX[i-1],RND_NumerosArrayY[i-1]); stroke(10,10,10,80); line(NumerosArrayX[i],NumerosArrayY[i],NumerosArrayX[i-1],NumerosArrayY[i-1]); }else{ stroke(10,10,10,20); line(RND_NumerosArrayX[i],RND_NumerosArrayY[i],tamanhoHEIGHT/2,NumerosArrayY[i-1]); stroke(10,10,10,80); line(NumerosArrayX[i],NumerosArrayY[i],tamanhoHEIGHT/2,NumerosArrayY[i-1]); } NumerosArrayX[i] = NumerosArrayX[i] + int(random(-3,3)); NumerosArrayY[i] = NumerosArrayY[i] + int(random(-3,3)); RND_NumerosArrayX[i] = RND_NumerosArrayX[i] + int(random(-4,4)); RND_NumerosArrayY[i] = RND_NumerosArrayY[i] + int(random(-4,4)); } } 
informatique/processing/closed_lines.txt · Dernière modification : 23/09/2012 09:59 de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki