View Full Version : Kirupa's Snow Effect
NeoDreamer
June 20th, 2003, 01:19 AM
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.
kode
June 20th, 2003, 02:28 AM
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? :)
NeoDreamer
June 20th, 2003, 03:05 PM
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.
kode
June 20th, 2003, 06:16 PM
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.
2) i already answered that question. i couldn't find the stupid thread so here it is again. :P
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. ;)
NeoDreamer
July 10th, 2003, 12:38 PM
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.
Coppertop
July 10th, 2003, 04:42 PM
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 (www.coppertop.0catch.com) as well? please :beam:)
kode
July 11th, 2003, 11:45 AM
... :P
NeoDreamer
July 11th, 2003, 12:39 PM
There's only >> one site (http://www.yourethemannowdog.com/) << that can sum up your greatness. :)
kode
July 11th, 2003, 12:41 PM
^^ :P
as_clark20
March 4th, 2004, 11:04 AM
Arrrrrgggghhh!!!
I really needed the script for how to get the snow falling behind other layers but the site hosting the fla isn't there any more and the reference to the new site simply has a "coming soon" screen displayed!!!
Aaaararrrgggh!!! Anyone manage to get the script before the guy moved his website?
Thanks.
ScHAmPi
March 4th, 2004, 01:27 PM
Nope i didnt :(
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.