Posted by Sankar.G | Posted in AS2 | Posted on 3:53 PM
w = Stage.width;
h = Stage.height + 100;
max_snowsize = 10;
snowflakes = 40;
init = function ()
{
for( i = 0; i < snowflakes; i++ ) { t = attachMovie("snow", "snow"+i, i); t._alpha = 50 + Math.random()*50; t._x = -(w*0.5) + Math.random()*(1.5*w); t._y = -(h*0.5) + Math.random()*(1.5*h); t._xscale = t._yscale = 50 + Math.random()*(max_snowsize*10); t.k = Math.random()*1.5 + 1; t.wind = Math.random()*3.5 - 1.5; t.onEnterFrame = mover; } } mover = function () { this._y += this.k; this._x += this.wind; if(this._y > h+10)
{
this._y = -20;
}
if(this._x > w+20)
{
this._x = -(w*0.5) + Math.random()*(1.5*w);
this._y = -20;
}
else if(this._x < -20)
{
this._x = -(w*0.5) + Math.random()*(1.5*w);
this._y = -20;
}
}
init();
h = Stage.height + 100;
max_snowsize = 10;
snowflakes = 40;
init = function ()
{
for( i = 0; i < snowflakes; i++ ) { t = attachMovie("snow", "snow"+i, i); t._alpha = 50 + Math.random()*50; t._x = -(w*0.5) + Math.random()*(1.5*w); t._y = -(h*0.5) + Math.random()*(1.5*h); t._xscale = t._yscale = 50 + Math.random()*(max_snowsize*10); t.k = Math.random()*1.5 + 1; t.wind = Math.random()*3.5 - 1.5; t.onEnterFrame = mover; } } mover = function () { this._y += this.k; this._x += this.wind; if(this._y > h+10)
{
this._y = -20;
}
if(this._x > w+20)
{
this._x = -(w*0.5) + Math.random()*(1.5*w);
this._y = -20;
}
else if(this._x < -20)
{
this._x = -(w*0.5) + Math.random()*(1.5*w);
this._y = -20;
}
}
init();
Comments (0)
Post a Comment