[Smily Entry 1] - NodeDraw 1
Posted on March 11th, 2010 by mike
So I managed to port my NodeDraw thingie into only 20 lines of code! I'll probably post more than one version, the next maybe being an interactive one :)
It's using BitmapData to speed up the process so don't expect any details if you zoom in :P
I excluded the arrays so it won't lag kirupa and/or make a long page, the arrays will be in the attachment txt, they should be on line 1 and 2
WARNING: Very CPU intensive, it goes to the top while it's drawing. I made it
a bit progressive so it doesn't freeze and you can cancel (close) it at any time. You have been warned!
var bitmap:flash.display.BitmapData = new flash.display.BitmapData(800, 600, true, 0x000000);
var b:MovieClip = _root.createEmptyMovieClip("b", _root.getNextHighestDepth());
var c:MovieClip = _root.createEmptyMovieClip("c", _root.getNextHighestDepth());
var l:MovieClip = c.createEmptyMovieClip("l", c.getNextHighestDepth());
b.attachBitmap(bitmap, b.getNextHighestDepth());
var i = 0;
drawInt = setInterval(drawOne, 1);
function drawOne() {
for (var n = i+1; n
if (dist<100) {
c.l.clear();
c.l.lineStyle(1, (i+n)/2*0xFFFFFF/px.length, 50-dist);
c.l.moveTo(px[i], py[i]);
c.l.lineTo(px[n], py[n]);
bitmap.draw(c);
}
}
i++;
if (i>px.length) {
clearInterval(drawInt);
}
}
I would have loved to try going for tracing a picture with it if it was not for the insanely large arrays required :)
but i tried & copy paste this code in action panel & test it nothing is coming y
#If you have any other info about this subject , Please add it free.# |