diff nodejs/testcanvas.js @ 751:9f4a1134ec82

Use the coord.remove() to implement the processing canvas
author wycc
date Thu, 26 Aug 2010 00:28:12 +0800
parents cdd578c1f866
children cf60cf8983f8
line wrap: on
line diff
--- a/nodejs/testcanvas.js	Thu Aug 26 00:16:12 2010 +0800
+++ b/nodejs/testcanvas.js	Thu Aug 26 00:28:12 2010 +0800
@@ -11,14 +11,19 @@
 app.canvas.strokeWeight(8);
 width=200;
 height=200;
-for(i=0;i<width;i++) {
-    x = Math.random()*255;
-	y = Math.random()*200;
-	cr = Math.random()
-	cg = Math.random()
-	cb = Math.random()
-	app.canvas.stroke(cr,cg,cb,1);
-	app.canvas.line(i,0,x,height);
-}
+
+setInterval(function() {
+    app.canvas.clear();
 
+    for(i=0;i<width;i++) {
+        x = Math.random()*255;
+   	    y = Math.random()*200;
+	    cr = Math.random()
+	    cg = Math.random()
+	    cb = Math.random()
+	    app.canvas.stroke(cr,cg,cb,1);
+	    app.canvas.line(i,0,x,height);
+	}
+	app.update();
+},33);
 app.loop();