Extension:processingjs : Différence entre versions
De fablabo
(→donne :) |
|||
Ligne 50 : | Ligne 50 : | ||
} | } | ||
+ | </processingjs> | ||
+ | |||
+ | <processingjs> | ||
+ | /* @pjs font="Arial.ttf"; */ | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | size(200,200); | ||
+ | noLoop(); | ||
+ | textFont(createFont("Arial",32)); | ||
+ | } | ||
+ | |||
+ | void draw() | ||
+ | { | ||
+ | background(255); | ||
+ | String t = "P.js"; | ||
+ | float tw = textWidth(t); | ||
+ | fill(0); | ||
+ | text(t, (width-tw)/2, (height+32)/2); | ||
+ | } | ||
</processingjs> | </processingjs> |
Version du 2 avril 2012 à 10:52
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> /* @pjs font="Arial.ttf"; */
void setup() {
size(200,200); noLoop(); textFont(createFont("Arial",32));
}
void draw() {
background(255); String t = "P.js"; float tw = textWidth(t); fill(0); text(t, (width-tw)/2, (height+32)/2);
} </processingjs>