Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
732:6879aa403306 | 736:cdd578c1f866 |
---|---|
1 var mbapp = require("./mbapp"); | |
2 var sys=require("sys"); | |
3 var canvas=require("./canvas"); | |
4 | |
5 app = new mbapp.app(); | |
6 | |
7 app.canvas = new canvas.canvas(app,app.mb_rt.root); | |
8 | |
9 app.canvas.background(0,0,0,1); | |
10 app.canvas.rect(0,0,400,400); | |
11 app.canvas.strokeWeight(8); | |
12 width=200; | |
13 height=200; | |
14 for(i=0;i<width;i++) { | |
15 x = Math.random()*255; | |
16 y = Math.random()*200; | |
17 cr = Math.random() | |
18 cg = Math.random() | |
19 cb = Math.random() | |
20 app.canvas.stroke(cr,cg,cb,1); | |
21 app.canvas.line(i,0,x,height); | |
22 } | |
23 | |
24 app.loop(); |