Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> [fl]snow Effect, Simple Snow Efect Script
allstars
post Oct 3 2008, 08:16 PM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 11
Joined: 3-October 08
From: Romania
Member No.: 33,098



Here is a simple snow script that i will show you. Its pretty nice smile.gif.
Let's get started.
1.Draw a snow flake. (Using circle tool)
2.Select it and conert it to a symbol ( Ctrl+F8 ). Press movie clip, but don't click "ok" yet. Where it says "Linkage" click on export for action script.
3.For identifier put in, "flake".
4.Than put in following action script:

CODE
amount = 100;
mWidth = Stage.width;
mHeight = Stage.height;
for (var i = 0; i<amount; i++) {
thisFlake = this.attachMovie("flake", "flake"+i, i);
with (thisFlake) {
_x = Math.random()*mWidth;
_y = Math.random()*mHeight;
_xscale = _yscale=_alpha=40+Math.random()*60;
}
thisFlake.yspeed = Math.random()*2+ .1;
thisFlake.increment = -0.025+Math.random()*0.05;
thisFlake.onEnterFrame = function() {
this.radians += this.increment;
this._y += this.yspeed;
this._x += Math.sin(this.radians);
if (this._y>=mHeight) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
      if (this._x>=mWidth || this._x<=0) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
}
}


The code is very simple. I don't think it's any need to explain.
You can change the number of snowflakes by modifying :

CODE
amount = 100;


Hope it helped,
Cheers!
Go to the top of the page
 
+Quote Post
yordan
post Oct 4 2008, 03:27 PM
Post #2


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 2,238
Joined: 16-August 05
Member No.: 7,896
myCENTs:34.00



Thanks a lot for this script.
You first posted this in our tutorial section. Your own text is a little bit short, it can't be accepted as a tutorial, it's far below the 500 words thereshold. That's why I moved your topic here.
Regards
Yordan
Go to the top of the page
 
+Quote Post
FirefoxRocks
post Oct 4 2008, 05:56 PM
Post #3


Super Member
Group Icon

Group: [HOSTED]
Posts: 749
Joined: 12-July 06
From: Ontario, Canada
Member No.: 14,464



Is this to do with Dreamweaver? Photoshop? Fireworks? or what? It looked like JavaScript at first, but with all the _ characters, I'm not sure what it is. Please post what program this relates to when posting a "tutorial". That would help people follow the steps much easier wink.gif
Go to the top of the page
 
+Quote Post
Darasen
post Oct 5 2008, 12:03 AM
Post #4


Advanced Member
Group Icon

Group: [HOSTED]
Posts: 184
Joined: 3-April 08
From: Milling about
Member No.: 29,596
myCENTs:89.08



QUOTE
4.Than put in following action script:


Action Script is the Scripting language used in Adobe Flash.
Go to the top of the page
 
+Quote Post
CheckProgs
post Oct 12 2008, 08:06 PM
Post #5


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 22
Joined: 11-October 08
Member No.: 33,447
myCENTs:49.33



Wow, thanks. I'm going to use this for a Flash based comic I'm creating. I wish there was some sort of "Reputation", on these forums.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Image gallery script(7)


 



- Lo-Fi Version Time is now: 2nd December 2008 - 11:48 AM