Kirupa's Snow Effect

How can I alter Kirupa’s snow effect ( http://www.kirupa.com/developer/mx/snow.htm ) so that it begins on a slow start? Just have little snow start it off and then gradually reach the original effect.

instead of this code:

for (k=0; k<50; k++) {
	duplicateMovieClip(_root.snow, "snow"+k, k);
}

use this one:

var index, maxSnow = 50;
this.onEnterFrame = function() {
	if (++index<=maxSnow) snow.duplicateMovieClip("snow"+index, index);
	else delete this.onEnterFrame;
};

like that? :slight_smile:

  1. How do I get it to come in even more gradually? Ideally, I want to start out with 1 snowflake.
  2. How do I make the snow fall only in one specific area of my movie? IE X=300, Y=200, Height=100, Width=400.
  1. the code i posted duplicates de snow at the fps of your movie, if you want it slower/faster you could set up a function to duplicate the snow and an interval to call the function.
var index, maxSnow = 50;
duplicateSnow = function() {
if (++index<=maxSnow) snow.duplicateMovieClip("snow"+index, index);
else clearInterval(snowInterval);
};
var snowInterval = setInterval(duplicateSnow, 1000/4);

that way it would be duplicated 4 times per second.

  1. i already answered that question. i couldn’t find the stupid thread so here it is again. :stuck_out_tongue:
onClipEvent (load) {
	var xmin = 40, xmax = 140, ymin = 40, ymax = 240;
	i = 1+Math.random()*2;
	k = -Math.PI+Math.random()*Math.PI;
	this._xscale = this._yscale=50+Math.random()*100;
	this._alpha = 75+Math.random()*100;
	this._x = xmin+Math.random()*(xmax-xmin);
	this._y = ymin;
}
onClipEvent (enterFrame) {
	rad += (k/180)*Math.PI;
	this._x -= Math.cos(rad);
	this._y += i;
	if (this._y>=ymax || this._x<=xmin || this._x>=xmax) {
		this._x = xmin+Math.random()*(xmax-xmin);
		this._y = ymin;
	}
}

change the xmin, xmax, ymin and ymax values to whatever you need. :wink:

All your code worked. Thanks.

How do you get the snow to appear on the actual layer that I put it on? It appears as the top layer and blocks a bunch of stuff on my site.

yes, i’m having a similar problem with dublicating movie clips. how can i get them to appear below stuff?

to see the actual file i’m talking about, go here www.coppertop.0catch.com/flash/hovercraft.htm
(could do me a favour and visit the main site as well? please :beam:)

:stuck_out_tongue:

There’s only >> one site << that can sum up your greatness. :slight_smile:

^^ :stuck_out_tongue: