PDA

View Full Version : freeskier89→ 5. StarFractal



freeskier89
January 29th, 2006, 05:24 AM
Wow, this has to be the fastest I have coded a fractal before. :D Let me know what you think!
Stage.scaleMode = "noScale";
container=_root.createEmptyMovieClip("c1",1);
depthvar=2;
points= 2+random(6);
function CreateStar(x, y, width,r) {
mc = _root.container.createEmptyMovieClip("s"+(depthvar++), depthvar);
mc.lineStyle(width/4, 0x5797D7, 30);
mc.beginFill(0x48BCE1, 50);
for (var t = 0; t<360; t += 5) {
(t != 0) ? mc.lineTo((width*.75+width*.25*Math.sin(t*points*M ath.PI/180))*Math.cos(t*Math.PI/180), (width*.75+width*.25*Math.sin(t*points*Math.PI/180))*Math.sin(Math.PI/180*t)) : mc.moveTo((width*.75+width*.25*Math.sin(t*points*M ath.PI/180))*Math.cos(t*Math.PI/180), (width*.75+width*.25*Math.sin(t*points*Math.PI/180))*Math.sin(Math.PI/180*t));
}
mc.endFill();
mc._x = x;
mc._y = y;
mc._rotation=r;
}
Stack = [{x:275, y:200, w:100,t:0}];
onEnterFrame = function () {
star = Stack.shift();
for (var t = 0; t<Math.PI*2; t += Math.PI/180*(360/points)) {
x = star.x+star.w*(1+(1/2.5))*Math.cos(t+1.5*(Math.PI/180*(360/points)));
y = star.y+star.w*(1+(1/2.5))*Math.sin(t+1.5*(Math.PI/180*(360/points)));
Stack.push({x:x, y:y, w:star.w/2.5,a:t});
}
CreateStar(star.x, star.y, star.w,star.a*(180/Math.PI)+90);
};
onMouseDown=function(){
container=_root.createEmptyMovieClip("c1",1);
Stack = [{x:275, y:200, w:100,t:0}];
points=(2+random(6));
}
Click to generate an new fractal that is between 2 and 7 sides. 2 and 3 sided ones are the coolest :)

You must see the 3 sided one :love:

-freeskier89 :)

hybrid101
January 29th, 2006, 05:40 AM
man, i love your entries, this is gotta be one of the nicest i've seen. it looks like a snowflake, lol. :thumb:

freeskier89
January 29th, 2006, 05:50 AM
Thanks hybrid! :hugegrin: I just added resetablity so that it will generate a fractal with a random amount of sides ;)

virusescu
February 2nd, 2006, 05:23 PM
That's very very cool FreeSkier ;). I dig it.

GNXDan
February 3rd, 2006, 01:45 PM
people like you should be in an institution

freeskier89
February 3rd, 2006, 04:35 PM
people like you should be in an institution Haha :lol:

I am not sure quite how to decipher that. Am I mad/crazy? :P

-freeskier89 :sc:

TheCanadian
February 3rd, 2006, 06:51 PM
:thumb::thumb::thumb: Three thumbs up!

Pasquale
February 3rd, 2006, 09:25 PM
I love your work man keep it up!!!!!!11

Seb Hughes
February 4th, 2006, 04:50 AM
That very nice, and yeah freeskier89 flash is very good. Keep it up bro :D

_Bruno
February 4th, 2006, 10:33 AM
wow!
cool! kept me playing with it for 10 minutes :sc:
zooming in - out, clicking and stuff
you are right, the 3 sided is my favourite as well

good luck