The Dink Network

lolsquitos

April 18th 2007, 06:24 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
I got a little bored today, so I made something. Move the mouse around and stuff.
JavaScript required.
April 18th 2007, 06:34 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
That's pretty crazy, me likes
April 18th 2007, 09:10 PM
anon.gif
dinkmega
Ghost They/Them
 
Woot lolsquitos rock!!
April 19th 2007, 01:49 AM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
That's pretty cool Though, some of the lols seem to follow the cursor a bit too much when you move it around like crazy.
April 19th 2007, 02:43 AM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Could be, all seperate lols have different properties (like speed settings), so some might swarm around too fast.
I made some variations on this. I'll post another one that I customized a bit.

EDIT

NOTE: you can have more fun with this if you have Firefox and the Web Developer toolbar. Increase/decrease the amount of elements! Make your own elements float around the cursor (it works with anything)! Etcetera.
April 19th 2007, 08:22 AM
pq_cthunik.gif
GOKUSSJ6
Peasant He/Him Poland
Everyone should get a pizza for free in each week. 
Cool.

BTW Why don't you make a flash movie with Dink?
April 19th 2007, 10:01 AM
goblinm.gif
It's not flash?
April 19th 2007, 10:23 AM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Nope, it's Javascript. With some effort I could probably make a game in the browser without needing anything but Javascript. About any browser probably supports that.
April 19th 2007, 07:57 PM
anon.gif
dinkmega
Ghost They/Them
 
Isn't Davince a genius?
And so are many, many, many more people in TDN.
April 19th 2007, 08:10 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Certainly not me.
Some people here ARE genious though, like SimonK and Redink1. ^_^
April 19th 2007, 08:26 PM
goblinm.gif
Can't forget Paul.
April 20th 2007, 09:34 AM
wizard.gif
Chrispy
Peasant He/Him Canada
I'm a man, but I can change, if I have to.I guess. 
I'm guessing that you made either oscillating attraction wells around the cursor? I'm pretty sure they aren't just rotating the cursor, as element were rotating in both directions. Does each element have different properties? Interesting, from a physics p.o.v.
April 20th 2007, 09:40 AM
goblinm.gif
function loop()
{
for (var i = 0; i < elements.length; i++)
{
if (elements[i].x < xmouse) elements[i].xspeed+=elements[i].speed;
else if (elements[i].x > xmouse) elements[i].xspeed-=elements[i].speed;

if (elements[i].xspeed > 20) elements[i].xspeed = 20;
else if (elements[i].xspeed < -20) elements[i].xspeed = -20;
elements[i].x += elements[i].xspeed;


if (elements[i].y < ymouse) elements[i].yspeed+=elements[i].speed;
else if (elements[i].y > ymouse) elements[i].yspeed-=elements[i].speed;

if (elements[i].yspeed > 20) elements[i].yspeed = 20;
else if (elements[i].yspeed < -20) elements[i].yspeed = -20;
elements[i].y += elements[i].yspeed;


elements[i].element.style.left = elements[i].x + "px";
elements[i].element.style.top = elements[i].y + "px";
}

setTimeout("loop();", 10);
}

So basically they just move towards the cursor.
April 20th 2007, 12:13 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Basically infinite:

if x < mouse x: add to its speed.
if x > mouse x: subtract from its speed.
each loop: set x to x + speed.

So it basically moves towards the mouse, then keeps revolving around the mouse position because the object will never stop at a speed of 0. It speeds up, then brakes only to speed up exactly as fast as it was before.

I'm not too great at maths, so I wouldn't know any technical terms for this.

If you download the page and edit the variable "amount" to be 1, you can really see how it moves in comparison to the mouse.
April 20th 2007, 01:47 PM
goblinm.gif
Yeah, there's no real world analogy, even if we reduce it to one dimension; the y-component of a pendulum is the closest, but still pretty far. Basically the lolsquitos experience a force of constant magnitude towards the cursor, except it's not exactly towards the cursor, just towards the closest of NW, NE, SE, or SW. In nature, forces are almost never of constant magnitude, they vary with position.
April 20th 2007, 04:33 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
A few Math.random()s could fix that, even if they're only semi-randoms...
April 20th 2007, 07:06 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
>_>

<_<

I got a request from someone. Can you believe it?
April 21st 2007, 08:45 AM
wizard.gif
Chrispy
Peasant He/Him Canada
I'm a man, but I can change, if I have to.I guess. 
Aha, that makes sense. I was watching the motion of some individual element, and they seemed to be following illogical orbits (Like a repeated semicircle about with the centroid at the cursor)

My curiosity is satisfied.
April 21st 2007, 02:52 PM
duck.gif
Malibu
Peasant He/Him
 
1. Get high as a kite
2. Play around with your lolsquitos
3. ???
4. Profit