Modifications

Extension:processingjs

2 024 octets ajoutés, 27 avril 2012 à 11:52
exemple
l'extension Processingjs permet d'entrer du code processing qui sera directement interprété dans le wiki à l'aide de http://processingjs.org
 
http://www.mediawiki.org/wiki/Extension:ProcessingJs
==exemple==
<nowiki>
<processingjs>
 
<nowiki><processingjs></nowiki>
<code lang="java"><processingjs>
void setup(){
}
</code><nowiki></processingjs></nowiki>  ==problèmes connus== erreur en cas d'url simplifiée
==donne :==
size( 200, 200 );
strokeWeight( 10 );
println("hop");
}
<processingjs>
String// All Examples Written by Casey Reas and Ben Fry // unless otherwise stated. // center point float centerX = 0, centerY = 0;   float radius = 45, rotAngle = -90; float accelX, accelY; float springing = .0085, damping = .98;   //corner nodes int nodes = 5; float nodeStartX[] = new float[nodes]; float nodeStartY[] = new float[nodes]; float[]nodeX = new float[nodes]; float[]nodeY = new float[nodes]; float[]angle = new float[nodes]; float[]frequency = new float[nodes];   // soft-body dynamics float organicConstant = 1;   void setup() {  size(800, 200);  //center shape in window  centerX = width/2;  centerY = height/2;  // iniitalize frequencies for corner nodes  for (int i=0; i<nodes; i++){  frequency[i] fontList = PFont.listrandom(5, 12);  }  noStroke();  smooth();  frameRate(30); }   void draw() {  //fade background  fill(0, 100);  rect(0,0,width, height);  drawShape();println moveShape(fontList); }   void setupdrawShape(){  // calculate node starting locations  for (int i=0; i<nodes; i++) nodeStartX[i] = centerX+cos(radians(rotAngle))*radius;  nodeStartY[i] = centerY+sin(radians(rotAngle))*radius;  rotAngle += 360.0/nodes;  size}    // draw polygon  curveTightness(organicConstant);  fill(200,200255);  noLoopbeginShape();font for (int i= createFont0; i<nodes; i++){  curveVertex(nodeX[i], nodeY[i]);  }  for ("sansint i=0; i<nodes-serif"1; i++){  curveVertex(nodeX[i], 32nodeY[i]);textFont }  endShape(font, 32CLOSE);
}
  void drawmoveShape(){  //move center point  float deltaX = mouseX-centerX;  float deltaY = mouseY-centerY;    // create springing effect  deltaX *= springing;  deltaY *= springing;  accelX += deltaX;  accelY += deltaY;    // move predator's center  centerX += accelX;  centerY += accelY;    // slow down springing{ background(255)accelX *= dampingString t accelY *= "P.js"damping;    // change curve tightness  float tw organicConstant = textWidth1-(t(abs(accelX)+abs(accelY))*.1);    fill//move nodes  for (int i=0; i<nodes; i++);{  text nodeX[i] = nodeStartX[i]+sin(t, radians(width-twangle[i]))/*(accelX*2, );  nodeY[i] = nodeStartY[i]+sin(height+32radians(angle[i]))/*(accelY*2);  angle[i]+=frequency[i];  }
}
 
</processingjs>
 
[[testPjs]]
0
6 691
modifications