lolsquitos
I got a little bored today, so I made something. Move the mouse around and stuff.
JavaScript required.
JavaScript required.
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.
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.
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.
Cool.
BTW Why don't you make a flash movie with Dink?
BTW Why don't you make a flash movie with Dink?
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
dinkmega
Isn't Davince a genius?
And so are many, many, many more people in TDN.
And so are many, many, many more people in TDN.
Certainly not me.
Some people here ARE genious though, like SimonK and Redink1. ^_^
Some people here ARE genious though, like SimonK and Redink1. ^_^
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.
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.
{
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.
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.
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.
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.
A few Math.random()s could fix that, even if they're only semi-randoms...
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.
My curiosity is satisfied.