I have found that i can create stuff in processing and post them on to the blog, this is good, it means I will be able to post examples with my notes etc XD.
You do it using processingjs wich can be found at processingjs.org.
You can either have the processing.js file on your server or you can load it from the application website. I got the example moving circle below along with the code/script used.
The script I used (copy and pasted from Link) is as follows:
<
script type="application/processing"
>
float radius = 50.0;
int X, Y;
int nX, nY;
int delay = 16;
void setup(){
size( 200, 200 );
strokeWeight( 10 );
frameRate( 15 );
X = width / 2;
Y = width / 2;
nX = X;
nY = Y;
}
void draw(){
radius = radius + sin( frameCount / 4 );
X+=(nX-X)/delay;
Y+=(nY-Y)/delay;
background( 100 );
fill( 0, 121, 184 );
stroke(255);
ellipse( X, Y, radius, radius );
}
void mouseMoved(){
nX = mouseX;
nY = mouseY;
}
<
canvas width="320" height="240">
<
script
src='http://processingjs.org/source/current/pjs-init.js'>
"
No comments:
Post a Comment