PDA

View Full Version : [Smily Entry 1] - NodeDraw 1



Smily
January 23rd, 2006, 08:27 PM
I'm a bit late on this one, but here it is...
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<px.length; n++) {
var dist = Math.sqrt(Math.pow(px[i]-px[n], 2)+Math.pow(py[i]-py[n], 2));
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);
}
}

jerez_z
January 23rd, 2006, 10:00 PM
wow. very well done. like wow

kdd
January 23rd, 2006, 10:32 PM
wow, that's awesome...

danulf
January 24th, 2006, 05:02 AM
cool! :D

Gelatine Cow
January 24th, 2006, 08:00 AM
Nice and shiny! ;)

treatkor
January 24th, 2006, 09:10 AM
nice!!!

hybrid101
January 26th, 2006, 12:03 AM
i'm speechless...

Seb Hughes
January 26th, 2006, 06:34 AM
wow, that is just amazing, Im gob smacked. Im loving it :love:

SimplyArun
February 6th, 2006, 03:52 AM
Great job dude :thumb2:

mlk
February 6th, 2006, 06:30 PM
what the???? you get my vote !

Smily
February 8th, 2006, 12:59 AM
Yay, thanks to all! Especially Fez..uhm..I mean mlk :D

te5tpattern
February 20th, 2006, 08:04 PM
beautiful

vega
July 14th, 2006, 09:04 AM
Great job man!

I would have loved to try going for tracing a picture with it if it was not for the insanely large arrays required :)

neeraj8585
February 28th, 2008, 07:00 AM
you hav done a good effort

but i tried & copy paste this code in action panel & test it nothing is coming y