view nodejs/testcanvas.js @ 799:ba6bb69ee419

Fix issue of incorrect top position of bbox. x of bbox generated by Inkscape is left-bottom corner and relative to left-bottom corner of page. Up-direction is positive. But, in previous implement, it assume getting a left-top corner. It is wrong, and it is fixed, now.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 31 Aug 2010 14:54:47 +0800
parents cf60cf8983f8
children 586e50f82c1f
line wrap: on
line source

// vim: ts=4
var mbapp = require("./mbapp");
var sys=require("sys");
var canvas=require("./canvas");

app = new mbapp.app();

app.canvas = new canvas.canvas(app,app.mb_rt.root);

app.canvas.background(0,0,0,1);
app.canvas.rect(0,0,400,400);
app.canvas.strokeWeight(8);
width=200;
height=200;

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();