« Extension:processingjs » : différence entre les versions

De fablabo
Aller à :navigation, rechercher
Cedric (discussion | contributions)
Cedric (discussion | contributions)
Ligne 60 : Ligne 60 :
   size(200,200);
   size(200,200);
   noLoop();
   noLoop();
font = createFont(@font-face , 32);
font = createFont("@font-face" , 32);
textFont(font, 32);  
textFont(font, 32);  
   
   

Version du 2 avril 2012 à 12:06

l'extension Processingjs permet d'entrer du code processing qui sera directement interprété dans le wiki à l'aide de http://processingjs.org


exemple

<processingjs> void setup(){ size( 200, 200 ); strokeWeight( 10 ); } void draw(){ background(0); ellipse( mouseX, mouseY, 100, 100 ); } </processingjs>

donne :

<processingjs> void setup(){

 size( 200, 200 );
 strokeWeight( 10 );

}


void draw(){

 background(0);  
 ellipse( mouseX, mouseY, 100, 100 );                  

}

</processingjs>


<processingjs> void setup(){

 size( 600, 100 );
 strokeWeight( 10 );

}


void draw(){

 background(200,20,10);  
 ellipse( mouseX, mouseY, 100, 100 );                  

}

</processingjs>

<processingjs>

String[] fontList = PFont.list();

println(fontList);

void setup() {

 size(200,200);
 noLoop();

font = createFont("@font-face" , 32); textFont(font, 32);

}

void draw() {

 background(255);
 String t = "P.js";
 float tw = textWidth(t);
 fill(0);
 text(t, (width-tw)/2, (height+32)/2);

} </processingjs>