Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8591505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:32:36+00:00 2026-06-11T23:32:36+00:00

How can I make the snow clear after a certain time. I’ve tried using

  • 0

How can I make the snow clear after a certain time. I’ve tried using variables and the calling a timeout which switches on to false and stops the makesnow() function but that doesn’t seem to clear the page at all.

<script language="javascript">


ns6 = document.getElementById;
ns  = document.layers;
ie  = document.all;


/*******************[AccessCSS]***********************************/
function accessCSS(layerID) {                                                                   //
  if(ns6){ return document.getElementById(layerID).style;}     //
   else if(ie){ return document.all[layerID].style; }         //
    else if(ns){ return document.layers[layerID]; }          //
}/***********************************************************/


/**************************[move Layer]*************************************/
function move(layer,x,y)  { accessCSS(layer).left=x; accessCSS(layer).top = y; } 


function browserBredde() {
    if (window.innerWidth) return window.innerWidth;
    else if (document.body.clientWidth) return document.body.clientWidth;
    else return 1024;
}

function browserHoyde() {

        if (window.innerHeight) return window.innerHeight;
        else if (document.body.clientHeight) return document.body.clientHeight;
        else return 800;
}

function makeDiv(objName,parentDiv,w,h,content,x,y,overfl,positionType)
{     
      // positionType could be 'absolute' or 'relative'

        if (parentDiv==null) parentDiv='body';

    var oDiv = document.createElement ("DIV");
    oDiv.id = objName;

        if (w) oDiv.style.width = w;
        if (h) oDiv.style.height= h;


      if (content) oDiv.innerHTML=content;
      if (positionType==null) positionType="absolute";
        oDiv.style.position = positionType;
        if (x) oDiv.style.left=x; else oDiv.style.left=-2000;
        if (y) oDiv.style.top=y; else oDiv.style.top=-2000;


        if (overfl) oDiv.style.overflow=overfl; else oDiv.style.overflow="hidden";
    eval('  document.'+parentDiv+'.appendChild (oDiv);  ');

    delete oDiv;
}

var snowC=0;
var x = new Array();
var y = new Array();
var speed = new Array();
var t=0;
var cC = new Array();
var ra = new Array();



function makeSnow() {
    x[snowC] = Math.round(Math.random()*(browserBredde()-60));
    y[snowC] = 10;
    makeDiv("snow"+snowC,"body",32,32,'<img src="http://i693.photobucket.com/albums/vv296/KIBBLESGRAMMY/CAT/Orange-tabby-cat-icon.gif">');
    speed[snowC] = Math.round(Math.random()*8)+1;
    cC[snowC]=Math.random()*10;
    ra[snowC] = Math.random()*7;
    snowC++;        
}



function moveSnow() {
    var r = Math.round(Math.random()*100);
    if (r>70 && snowC<20) makeSnow();
    for (t=0;t<snowC;t++) {
        y[t]+=speed[t];move("snow"+t,x[t],y[t]);
        if (y[t]>browserHoyde()-50) {y[t] = 10;x[t] = Math.round(Math.random()*(browserBredde()-60));}
        cC[t]+=0.01;
        x[t]+=Math.cos(cC[t]*ra[t]);

    }

    setTimeout('moveSnow()',20);
}

moveSnow();



</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:32:38+00:00Added an answer on June 11, 2026 at 11:32 pm

    makeSnow just adds the snowflakes. Stopping that, as you say, does not clear anything. moveSnow handles the animation, and calls itself at a timeout. If instead of setting a timeout for the next moveSnow each time, you set it up to run in an interval just once, you would have an easier time stopping it.

    window.snowAnimation = window.setInterval(moveSnow, 20);
    

    If you add a css class to your snow flakes, it would be easier to target them for deletion.

    oDiv.className = 'snowflake';
    

    Then your clear function could look something like:

    function clearSnow() {
       window.clearTimeout(window.snowAnimation);
       var flakes = document.getElementsByTagName('snowflake');
       for(var i = 0, l = flakes.length; i < l; i++) {
          document.body.removeChild(flakes[i]);
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can make a variable's name from two variables' value: $a = 'tea'; $b
I can make my program write a .dat file with an array of Node
How can make a link within a facebox window that redirects it to another
I can make a single row IKImageBrowserView by setting the [imageBrowser setContentResizingMask:NSViewWidthSizable]; but in
I can make a log in for easily, so that's not the problem. What
I can make batch or vbs file on windows and run. this can automate
Can someone tell me how I can make a table be 100% height in
Can someone tell me how I can make the following output? I have a
Anyone know how I can make a login button in Ruby on Rails for
In GNUPlot you can make 3d plots based on a .dat file with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.