# [FMX] the falling snow tutorial

i would really appreciate it if someone could give me a more in depth explanation of how this tutoiral works:
http://www.kirupa.com/developer/mx2004/snow.htm

i understand the ideas behind the script and what you are asking flash to do. the thing is my maths isnt that great. if someone could explain how some of the equations work, that would be excellent

examples:

this._alpha = 20+Math.random()*50; [color=#ff0000]ok, randomising alpha. got it. but where do these numbers come from? how did you reach them?[/color]
or
// horizontal movement
xmovement = _root._xmouse;
[color=red]understand what this is trying to do here. butâ€¦ manâ€¦ the maths goes right over the top of my headâ€¦ and explanation??[/color]

[color=black]thanks very much in advance!! ;)[/color]

-hazza

For the first part, the numbers 20 and 50 are arbitrary, meaning you can change them and get different ranges of alpha values for your snowflakes.

The second part first updates a radian variable, which is used to randomize horizontal movement of the snowflake. Thatâ€™s what Math.cos(rad) does. Then you add to it where your mouse is on the screen, so it can move based on that as well. Iâ€™d suggest toying around with the numbers and seeing what happens.

[QUOTE=coolname]For the first part, the numbers 20 and 50 are arbitrary, meaning you can change them and get different ranges of alpha values for your snowflakes.

[QUOTE]

i understand that these numbers are used to randomise the alpha, but how does: 20+Math.random()*50; work? what numbers will it be randomly choosing from is i guess what im trying to ask. becuase i could just be wacking in any old numbers in those gaps.