PDA

View Full Version : [DBarbarian Entry 5] - Particle Clock



dbarbarian
January 16th, 2006, 03:00 AM
Mouse.hide();
Stage.scaleMode = "noScale";

this.pA = function(n,prop,val) {
this.methodsA = {lineStyle:["w","c","a"],moveTo:["x","y"], curveTo:["cx","cy","ax","ay"], cx:["x"], cy:["y"], del:["d"], rad:["r"], ang:["a"]};
(prop=="lineStyle" or prop == "moveTo" or prop=="curveTo") ? n[prop](val[this.methodsA[prop][0]],val[this.methodsA[prop][1]],val[this.methodsA[prop][2]],val[this.methodsA[prop][3]]) : n[prop]=(val[this.methodsA[prop][0]]);
return n;
}

this.oA = new Array();

this.create = function(r,i,off,off2,r2,col) {
this.createEmptyMovieClip("o"+i,i);
this.pA(this["o"+i],"lineStyle",{w:r,c:col,a:100})._parent.pA(this["o"+i],"moveTo",{x:0,y:-r/2})._parent.pA(this["o"+i],"curveTo",{cx:-r/2,cy:-r/2,ax:-r/2,ay:0})._parent.pA(this["o"+i],"curveTo",{cx:-r/2,cy:r/2,ax:0,ay:r/2})._parent.pA(this["o"+i],"curveTo",{cx:r/2,cy:r/2,ax:r/2,ay:0})._parent.pA(this["o"+i],"curveTo",{cx:r/2,cy:-r/2,ax:0,ay:-r/2})._parent.pA(this["o"+i],"cx",{x:this._xmouse})._parent.pA(this["o"+i],"cy",{y:this._ymouse})._parent.pA(this["o"+i],"del",{d:3*(i-off)})._parent.pA(this["o"+i],"ang",{a:-Math.PI/2-(i-1)*Math.PI/6})._parent.pA(this["o"+i],"rad",{r:(i-off2)*r2});
this.oA.push(this["o"+i]);
}
for (i=1;i<36;i++) {
(i<13) ? this.create(((((i+2)%3)==0) ? 3 : 1.5),i,0,i-1,70,((((i+2)%3)==0) ? "0x33FF33" : "0xFFFFFF")):null; //ring
(i>12 and i<17) ? this.create(3,i,12,13,10,"0xFFFFFF"):null; //hours
(i>16 and i<25) ? this.create(2,i,16,16,7,"0xFFFFFF"):null; //minutes
(i>24 and i<36) ? this.create(1,i,24,25,6,"0xFF0033"):null; //seconds
}

this.onEnterFrame = function() {
for (i=1;i<36;i++) {
for (j=0;j<2;j++) {
(j==0) ? (this["o"+i].cx += ((this._xmouse-this["o"+i].cx)/this["o"+i].del)) : this["o"+i].cy += ((this._ymouse-this["o"+i].cy)/this["o"+i].del);
(j==0) ? (this["o"+i]._x = this["o"+i].cx + this["o"+i].rad*Math.cos(this["o"+i].ang)):(this["o"+i]._y = this["o"+i].cy +this["o"+i].rad*Math.sin(this["o"+i].ang));
(j==0) ? (this.rad += (Math.sqrt((this._xmouse-this.px)*(this._xmouse-this.px)+(this._ymouse-this.py)*(this._ymouse-this.py))-this.rad)/30) : this.myDate = new Date();
this["o"+i]._xscale = this["o"+i]._yscale = 60+random(60+5*(this["o"+i]._x-this["o"+i].px+this["o"+i]._y-this["o"+i].py));
(j==0) ? (this["o"+i].px = this["o"+i]._x) : (this["o"+i].py = this["o"+i]._y);
(j==0) ? (this.px = this._xmouse) : (this.py = this._ymouse);
}
(i>12 and i<17) ? (this["o"+i].ang = ((this.myDate.getHours()-12)*Math.PI/6-Math.PI/2)+this.myDate.getMinutes()*Math.PI/360) : null; //hours
(i>16 and i<25) ? (this["o"+i].ang = (this.myDate.getMinutes()*Math.PI/30-Math.PI/2)) : null; //minutes
(i>24 and i<36) ? (this["o"+i].ang = (this.myDate.getSeconds()*Math.PI/30-Math.PI/2)) : null; //seconds
}
}

kdd
January 16th, 2006, 03:04 AM
:*( - happy tears...
holy crap that's too good

Gelatine Cow
January 16th, 2006, 03:22 AM
There's freakin awesome, then there's this.

bombsledder
January 16th, 2006, 03:42 AM
wow...it would take me at least 50 lines to even make a look-alike like that good job =(

J
January 16th, 2006, 04:09 AM
Gr8
Thats cool

danulf
January 16th, 2006, 06:24 AM
nice! Reminds me of sites I made when I was in 6th grade... :D

kookaburra
January 16th, 2006, 06:28 AM
Great job!
You're a serious contender..

icio
January 16th, 2006, 06:33 AM
That's really cool, but I think it's just over 25 lines.

hybrid101
January 16th, 2006, 07:37 AM
holy crap man! that is friggin awesome! i love it!

squan
January 16th, 2006, 07:43 AM
Damn you barbarians, always unstoppable ... :)

***-pinchin splendid.

nathan99
January 16th, 2006, 08:11 AM
(i<13) ? this.create(((((i+2)%3) == 0) ? 3 : 1.5), i, 0, i-1, 70, ((((i+2)%3) == 0) ? "0x33FF33" : "0xFFFFFF")) : null;


I dont think thats allowed

dbarbarian
January 16th, 2006, 12:39 PM
Thanks everyone :) :)

icio: From what I understand from the rules, it should be just at 25 lines including the lines initiating for loops. Fnction declarations shouldn't count toward your line count.

nathan99: Although that line might look illegal, I think it should be allowed since I'm not actually "daisy-chaining commands together." It is a function calls, with parameters inserted. The conditionals within the call might be a little iffy though, we'll see what kirupa says. I can always take out the noScale and hideMouse.

icio
January 16th, 2006, 01:06 PM
From what I understand from the rules, it should be just at 25 lines including the lines initiating for loops. Fnction declarations shouldn't count toward your line count.
I was also talking about the `? :` usage. It only counts as one line if it's setting only one variable, but you use it to set several variables in one line.

Seb Hughes
January 16th, 2006, 01:07 PM
Wow thats really good, im a judge and this is a good contenter.


Happy people im nto showing bias towards it now.

trace
January 16th, 2006, 01:27 PM
wow i agree, on of the coolest things ive seen in a while, great job dBarbarian

sed|thh
January 16th, 2006, 02:07 PM
Lol it's 19:19 already! gotta finish homework

Sammo
January 16th, 2006, 02:08 PM
Wow thats really good, im a judge and that will be in one of my top picks
you're not alloud to show bias before all the entrants are in ;)

Pattt
January 16th, 2006, 02:40 PM
Aw ****, this is too good for anyone! :( :P :D
Hey, how is this working?


(j==0) ? (this["o...

squan
January 16th, 2006, 02:49 PM
condition ? statement : statement;

is the same as:

if (condition) {
statement;
} else {
statement;
}


It's a shorter way, hence extremely popular in this contest :)

Seb Hughes
January 16th, 2006, 04:42 PM
try make it faster, caus ei take sages to form :_(

Pattt
January 16th, 2006, 05:07 PM
condition ? statement : statement;

is the same as:

if (condition) {
statement;
} else {
statement;
}


It's a shorter way, hence extremely popular in this contest :)

Looks nice, maybe I'll try it. :)

Sinister Shadow
January 16th, 2006, 07:03 PM
Argh! You beat me to using a clock! Good job! :thumb2:

dbarbarian
January 17th, 2006, 11:17 PM
icio: I checked with Kirupa. He said that one is fine because I didn't change them together like a bunch of if else statements.

seb hughes: Thanks :) I'll speed it up a little bit.

trace: ("Thank you very much");

sed|thh: I should probably doing that too instead of this contest...

Prattt: Thanks, but there are a lot of really great entries out there.

Sinister Shadow: Meh. You can always do it again. As long as it's not the exact same, I'm sure no one cares. I know I don't :)

treatkor
January 18th, 2006, 12:12 AM
DBarbarian, this is really great!

Seb, as an "Offical 25 Line As Contest Judge" you probably shouldn't be publicly picking favorites just yet. even though this entry is awesome.

jerez_z
January 18th, 2006, 01:01 AM
I'm almost not going to try to make any more entries because of this one.. wow thats awesome. Your my hero.

dbarbarian
January 18th, 2006, 01:06 AM
treatkor: :)

jerez_z: Glad you liked it, but I hope you will still continue to create more entries :)

jerez_z
January 18th, 2006, 01:09 AM
I'm working on it when I get some good ideas

icio
January 18th, 2006, 05:23 PM
icio: I checked with Kirupa. He said that one is fine because I didn't change them together like a bunch of if else statements.
Ah, ok. Well thanks for doing that - it certainly clears it up :thumb:

Seb Hughes
January 19th, 2006, 10:03 AM
Am i not allowed to express my opiniopn, i said it was one of the best so far, and if it still is i might be lookign to pick it. Ive expressing myself, im not saying it will be.

jerez_z
January 19th, 2006, 10:48 AM
judges aren't allowed to have opinions until the judging starts seb (and definatley not express them). It comes with the job.

ElectricGrandpa
January 19th, 2006, 12:01 PM
Am i not allowed to express my opiniopn, i said it was one of the best so far, and if it still is i might be lookign to pick it. Ive expressing myself, im not saying it will be.

Sure, you can express your opinion somewhat... but don't say "it's one of the best so far", instead say "That's really nice looking". There's a huge difference, and if people think you're going to pick this one, then they might get discouraged and not make one at all.

Seb Hughes
January 19th, 2006, 12:59 PM
Well would it not motivate them to try and make a better one.

calvintage
January 22nd, 2006, 06:09 AM
omg this is so friggin cool! great work!! :thumb2:

ElectricGrandpa
January 23rd, 2006, 12:24 AM
Well would it not motivate them to try and make a better one.

Not if they think a judge has alright made up their mind... and not if they don't think they're capable of making something as good.

Sinister Shadow
January 23rd, 2006, 01:14 AM
Reverse psychology doesn't always work Seb. It took my parents far too long to realise that! :to:

pom
January 24th, 2006, 01:58 PM
Fun!

Sammo
January 24th, 2006, 03:04 PM
They have a point Seb, you've been doing this a lot in this contest, it's really not nice, as an entrant to read.

Joppe
January 24th, 2006, 03:46 PM
condition ? statement : statement;

is the same as:

if (condition) {
statement;
} else {
statement;
}


I dont really understand, if i want to only have



if(condition){
statement;
}

how would i put that in
condition ? statement : statement;
code ? :S

freeskier89
January 24th, 2006, 07:12 PM
after the colon put null ex:

condition ? statement : null;

Sinister Shadow
January 24th, 2006, 08:40 PM
after the colon put null ex:

ActionScript Code:

condition ? statement : null;




Is that legal? Hmmm... interesting... :book:

ElectricGrandpa
January 24th, 2006, 09:02 PM
Is that legal? Hmmm... interesting...

Yeah it's totally legal, it's just the equivalent of a normal "if" statement.

cryo.burned
February 8th, 2006, 11:20 PM
very awesome but pretty useless.. (sorry!) Its just that it takes so long to line up to a readable position

Maizoon
February 11th, 2006, 02:09 AM
I dont really understand, if i want to only have



if(condition){
statement;
}

how would i put that in
condition ? statement : statement;
code ? :S

Its called a ternary operator and its just a one line if/else. In the event your if has no else...just put 'null' at the end.

DJSK
March 17th, 2006, 02:32 AM
WOW!

vega
July 14th, 2006, 08:48 AM
oh my.... :luigi:

Thats just way too awesome...
Great work man. :)

rookiesmart
September 17th, 2006, 05:32 PM
boooeeeeh---now that`s awesome

mnkeymasta
October 8th, 2006, 02:50 PM
I :love::love::trout::gm: it!

jasvarghese
January 25th, 2007, 01:35 AM
Great man....