- Open a terminal and run the following commands
git clone [email protected]:dotnetthailand/falling-snow-in-typescript.git cd falling-snow-in-typescript yarn yarn run serve
- Open a browser and navigate to http://localhost:9999
- We think snowing has falling pattern like sin graph.
- Let's start by plotting y = sin(x)
- As you can see, this is not right.
- Falling of snow is an inversion of relationship
y = sin(x). - Swap y and x in the equation.
- Therefore, the inversion of the relationship
y = sin(x)isx = sin(y).
The equation of our falling snow is x = sin(y).
To make snow fall naturally, we need to randomly adjust our amplitude (height) and period (width) of a graph.
x = 4sin(y)
x = 1/2sin(y)
If y equal 1, it take two PI periods.
If y equal 1, it takes half of PI period.

.png)
.png)
-amplitude.png)
-amplitude-2.png)
-period.png)
-period-2.png)