PDA

View Full Version : freeskier89→ 4. Circular Space Filling


freeskier89
01-27-2006, 07:30 PM
Here is a circular space filling thing I made a while back, and modified to code to meet the guidelines. I know you guys are going to say I copied Chaoswarp, but actually I didn't. You can ask jerez_z if you wish, for I posted this at ffiles long before the contest began (http://ffiles.com/view_listing.php?sid=94&cat=18).


The motion was inspired by chaoswarp though, and I will make sure to give him part of the prize if I win with this one:hugegrin: function MaxRadius(center1, dist) {
for (var n = 0; n<stack.length; n++) (Math.sqrt((stack[n].center.x-center1.x)*(stack[n].center.x-center1.x)+(stack[n].center.y-center1.y)*(stack[n].center.y-center1.y))-stack[n].radius<dist) ? dist=Math.sqrt((stack[n].center.x-center1.x)*(stack[n].center.x-center1.x)+(stack[n].center.y-center1.y)*(stack[n].center.y-center1.y))-stack[n].radius : null;
(dist>225 || dist<1) ? dist=[1, 225][int(dist>225)] : null;
return dist;
}
MovieClip.prototype.FollowPoint = function(p) {
this._x = this._x+(p.x-this._x)/36;
this._y = this._y+(p.y-this._y)/36;
};
function DrawCircle(center, radius) {
circle = _root.createEmptyMovieClip("circle"+(depth++), depth);
circle._x = 200+300*Math.cos(Math.random()*Math.PI*2);
circle._y = 200+300*Math.sin(Math.random()*Math.PI*2);
circle._alpha=0;
circle.center = center;
circle.radius = radius;
circle.onPress = function(){
this.removeMovieClip();
}
stack==undefined ? stack=[circle] : stack.push(circle);
circle.lineStyle(radius/2+2, Math.min(radius*3,200) <<16 |Math.min(radius*3,200) <<8 | 0, 100);
circle.moveTo(radius, 0);
for (var t = 0; t<=Math.PI*2; t += Math.PI/30) circle.lineTo(radius*Math.cos(t), radius*Math.sin(t));
circle._width = circle._height=radius*2.4;
circle.onEnterFrame = function() {
((this.center.x >= this._x-.5 && this.center.x <= this._x+.5)&&(this.center.y >= this._y-5 && this.center.y <= this._y+5)) ? this.onEnterFrame = null : (this.FollowPoint(this.center) , this._alpha+=3);
};
}
drawCircle({x:random(Stage.width), y:random(Stage.height)}, 30+random(70), 0);
onEnterFrame = function () {
(maxRadius(center={x:Math.random()*Stage.width, y:Math.random()*Stage.height}, 400)>3) ? drawCircle(center, maxRadius(center, 400)) : null;
};Click on a circle to remove and have more smaller circles be generated in it. Refresh the page to get a whole new configuration.

Hope you like it!
-freeskier89 :)

JoshuaJonah
01-27-2006, 07:35 PM
post a swf:D

Pasquale
01-27-2006, 07:52 PM
NICE!!!

freeskier89
01-27-2006, 08:08 PM
Thanks Darkmotion! :D Defective, are you defective lol? jk. There is a swf there. For some reason the clicking on circles isn't working. hmm...

Pasquale
01-27-2006, 08:09 PM
yeah i was wondering why they seemed clickable. What does it do wehn ya click on it?

Krilnon
01-27-2006, 08:11 PM
Neat! The circles reminded me of http://www.acidtwist.com :)

freeskier89
01-27-2006, 08:15 PM
It removes the movieclip causing that area to be refilled. I don't have a clue why its not working. :( It works in flash.

Pasquale
01-27-2006, 08:19 PM
hmmm

Jeff Wheeler
01-27-2006, 08:45 PM
Absolutely awesome! One of my favorites so far. :D

TheCanadian
01-27-2006, 08:57 PM
Great work :thumb: - strange about the buttons though, I can click some and not others :tb:

JoshuaJonah
01-27-2006, 09:00 PM
i think it has something to do with levels.... but i dont see any instances of .getNextHighestLevel()

Jeff Wheeler
01-27-2006, 09:03 PM
I think the minimum thickness should be a bit larger. I dislike the hairline ones.

TheCanadian
01-27-2006, 09:05 PM
i think it has something to do with levels.... but i dont see any instances of .getNextHighestLevel()
That's probably a good thing since it's MovieClip.getNextHighestDepth() :ne:

treatkor
01-27-2006, 11:03 PM
:)
very nice freeskier

Pasquale
01-28-2006, 12:18 AM
I love these kina abstract things like levitated.net experiments :P - keep up the good work

kdd
01-28-2006, 12:53 AM
good work. yeah, i can click some but not others.

hybrid101
01-28-2006, 01:53 AM
same here, good job nonetheless!

freeskier89
01-28-2006, 01:54 AM
Thanks! It is acting really wierd. I should just take out the clicking thingy.

kirupa
01-28-2006, 02:09 AM
It looks really cool. I didn't even know it had a clicking feature :)

Jeff Wheeler
01-28-2006, 02:15 AM
Not sure if it's intentional, but after a while all the circles start disappearing.

NiñoScript
01-28-2006, 08:40 AM
nice :thumb:

freeskier89
01-28-2006, 01:11 PM
Alright I finally fixed the problem... I think it had to do with one or more of the following
1. Browsers cacheing the old file
2. One depth being undefined
3. Not creating the movieclips specifically at the root level (I doubt it though)

Oh, and I increased the minimum linewidth nokrev :D

Jeff Wheeler
01-28-2006, 04:41 PM
Thanks. :D

It's really cool now. Try adding some random alpha to the circles, and increasing the saturation (make them greener). That'd be cool ;)

treatkor
01-28-2006, 08:13 PM
greatly improved! i really like this one :thumb:
how hard would it be to do a version where it fills in the space inside of the circles too? ;)

freeskier89
01-29-2006, 02:03 AM
Alright nokrev, I upped the saturation of the colors. I think it looks much better :)

Treatkor, It would be kind of a pain to add your suggestion, and I am running out of time :(

Jeff Wheeler
01-29-2006, 02:23 AM
Awesome! :thumb:

But, since I'm a judge… I'm gonna perfect it. You should make the range of colors be bigger, so it can be a bit darker. ;)

Also, why does it form such a small square in the middle of the window? It should fill the entire window. :)

Sorry for nit-picking. I already love it. ;)

freeskier89
01-29-2006, 02:54 AM
:lol: Nokrev

Here you are master nokrev :D See the first post as usual :P

(Finally, this is my last update on this file)

Pasquale
01-29-2006, 03:04 AM
YAY i love it :P

we need more of these comps. the results are really beautiful to watch sometimes :P

Jeff Wheeler
01-29-2006, 03:17 AM
Blast. It's perfect. ;)

I can't come up with anything else… :(

treatkor
01-29-2006, 09:31 AM
Treatkor, It would be kind of a pain to add your suggestion, and I am running out of time :(
yeah i know. i was kidding about filling the interior space too. i think what you have looks excellent.

Seb Hughes
01-29-2006, 12:20 PM
Very nice Brandon :love:

It pwns hahaha J/K :D

Gelatine Cow
01-30-2006, 07:05 AM
Niiiiiiiiiiiiiiiiiiice!:cool:

Chaoswarp
02-06-2006, 01:35 PM
Thanks for mentioning me :), I did completely invent the idea of filling space with object all on my own, that whole fill a cup with water that was me. ;)

Actually this thing looks extremly cool. I really like it.

I am pushing for us both winning, that way space fitting project rule! Thats right I am starting a space fitting gang.

Either way great code! Glad to see other coders into the artistic side of programming :)