davidgagne.net

  • About
  • Archives
  • Twitter
  • Facebook
  • bartender.live
  • GitHub
  • LinkedIn

Winter

December 12th, 2001 @ 9:20 am PST

I found a script at Dreamhost to make it snow on the page. Let’s see if it works.

<SCRIPT language=”JavaScript1.2″>
<!–//
//Original script by Altan (Snow@altan.hr), copyright 1999 Altan d.o.o.
// http://www.altan.hr/snow/index.html
// Modified by Paul Anderson, copyright 2001 CNET Builder.com
var snowflake = “http://www.dreamhost.com/images/snow.gif”;
var no = 75; // number of snowflakes on the screen
var speed = 5; // smaller numbers make the snow fall faster
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var obj, i, doc_width = 800, doc_height = 600;
function winSize() {
doc_width = window.innerWidth?window.innerWidth:document.body.clientWidth;
doc_height = window.innerHeight?window.innerHeight:document.body.clientHeight;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
winSize();
document.write(“<STYLE type=”text/css”>.flake {position:absolute;top:-200;}</STYLE>”);
for (i = 0; i < no; i++) {
dx[i] = 0; // set coordinate variables
xp[i] = Math.random()*(doc_width-30) +10; // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20; // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random(); // set step variables
document.write(“<div id=”dot”+ i +”” class=”flake”><img src=””);
document.write(snowflake + “” border=”0″></div>”);
}
function snowMove(id,left,top) {
obj = document.getElementById?document.getElementById(id).style:
document.all?document.all[id].style:
document.layers?document.layers[id]:null;
if (obj) {
obj.left=left;
obj.top=top;
}
}
function snow() {
winSize();
doc_scroll = (window.pageYOffset!=null)?window.pageYOffset:document.body.scrollTop;
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] += sty[i];
if (yp[i] > doc_height+doc_scroll-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = doc_scroll;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
}
dx[i] += stx[i];
snowMove(“dot”+i,xp[i]+am[i]*Math.sin(dx[i]),yp[i]);
}
setTimeout(“snow()”, speed);
}
window.onload=snow;
//–>
</script>

More posts tagged:
Dreamhost / HTML / javascript / scripts / web design

More posts categorized:
comedy

More posts from:
December 2001 / 2001

Post navigation

Previous Post
Previous Post snaps
Next Post
Next Post Bin Laden on the Onion

Responses to “Winter”

  1. December 12th, 2001 @ 10:24 am
    lisa

    now THAT is too precious. too too precious.

  2. December 12th, 2001 @ 12:12 pm
    tober

    ok captain. annoying – you do realize this script makes the screen ‘wobble’ and the scroll bars to constantly readjust …

    oh yea – can the text on this comment page get any smaller?

  3. December 12th, 2001 @ 12:47 pm
    Beavis

    Hey Tober, are you still using IE5? Come join the rest of us in the 21st Century. It’s fun here.

  4. December 12th, 2001 @ 1:39 pm
    Tober

    it’s 5.5 to be exact and I refuse to upgrade to 6.0 because I’ve seen it bomb 3 workstations and I don’t beleive it’s ready yet.

    If joining the 21st century means I become one of Bill Gates Beta Slaves then no thanks, I’ll stay right here in IE5.5ville.

  5. December 12th, 2001 @ 1:44 pm
    Tober

    Yo david, you want to do something useful for MT? Design a spell checker plug-in.

    That’s “believe” not “beleive”
    thank you and good night.

    PS: any reason why you don’t auto for posts?

  6. December 12th, 2001 @ 1:45 pm
    Tober

    grrr. damn this “auto carriage return”

  7. December 12th, 2001 @ 3:49 pm
    dvg

    1) There already *is* a spell-checker for MovableType. I just haven’t gotten a chance to install it yet.
    2) Why don’t I “auto for posts”? I do not understand that question, Ryan.
    3) I’ve used IE6 for months now, on several platforms, and haven’t had any problems at all.

  8. December 12th, 2001 @ 8:45 pm
    Beavis

    *nyah*

  9. December 13th, 2001 @ 2:29 pm
    TheBrad

    No snow on a Mac, dude. Another reason for platform diversity: Less shoveling!

  10. December 13th, 2001 @ 7:41 pm
    madison

    oh thank god that’s snow. I thought I was either losing my vision, or losing my laptop.

  11. December 15th, 2001 @ 4:02 pm
    katie

    man.. people are bitter around this time of year.

    i think it’s cute. and i use opera. so nothing wobbles or blinks or skips. yeah. i rule.

  12. December 17th, 2001 @ 12:55 pm
    mike

    the script slows the load of your site (and my drive makes a really nice grinding sound, to boot). also, as the ‘snow’ falls and passes off to the right of the screen, the scrollbar at the bottom appears and disappears, all the while shifting the entire screen to the left about a 1/2″ – just enough to be irritating.

    i decided i ought to be specific.

Comments Closed

New comments are disabled on this post.

Search


Switch to FreshBooks

Switch to FreshBooks

I switched from QuickBooks to FreshBooks in 2015 and am so glad I did. Everything about their billing system is easier.

  • Take Control of Your Invoices

© David Vincent Gagne. All rights reserved. Custom WordPress Theme by Jacket Industries.