topical media & game development
lib-present-example-graphic-process.htm / htm
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Processing.js</title>
<script src="lib-present-example-graphic-process-files-processing.js"></script>
<script src="lib-present-example-graphic-process-files-init.js"></script>
</head><body>
<!--
application/processing script
-->
<script type="application/processing">
int pos = 0, dir = 1;
void setup(){
size(500, 500);
noStroke();
background( 0 );
}
draw
void draw(){
rotate( 15 * pos );
fill(0, 10);
rect(0, 0, width, height);
fill(255, 0, 0);
rect( pos, pos, 20, 20 );
pos += dir;
if ( pos > width ) {
dir = -1;
} else if ( pos + 20 < 0 ) {
dir = 1;
}
}
</script>
<!--
canvas
-->
<canvas id="canvas" height="500" width="500"></canvas>
</body></html>
(C) Æliens
20/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.