annotate nodejs/testcanvas.js @ 736:cdd578c1f866

Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
author wycc
date Sat, 21 Aug 2010 19:12:43 +0800
parents
children 9f4a1134ec82
rev   line source
736
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
1 var mbapp = require("./mbapp");
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
2 var sys=require("sys");
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
3 var canvas=require("./canvas");
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
4
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
5 app = new mbapp.app();
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
6
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
7 app.canvas = new canvas.canvas(app,app.mb_rt.root);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
8
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
9 app.canvas.background(0,0,0,1);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
10 app.canvas.rect(0,0,400,400);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
11 app.canvas.strokeWeight(8);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
12 width=200;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
13 height=200;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
14 for(i=0;i<width;i++) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
15 x = Math.random()*255;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
16 y = Math.random()*200;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
17 cr = Math.random()
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
18 cg = Math.random()
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
19 cb = Math.random()
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
20 app.canvas.stroke(cr,cg,cb,1);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
21 app.canvas.line(i,0,x,height);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
22 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
23
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
24 app.loop();