Skip to content

Commit 27aab34

Browse files
committed
Cosmetic changes
Conflicts: www/static/js/snow.js
1 parent 5325cb0 commit 27aab34

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

www/static/js/snow.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,23 @@
1212
Snowflake.prototype.tick = function() {
1313
var sidePhase = this.sidePhase += this.sideVel;
1414
this.y += this.vel;
15-
this.x = this.midX + Math.sin(sidePhase) * this.sideAmp;
15+
this.x += this.sideVel;
1616
};
1717
Snowflake.prototype.reset = function(maxX) {
1818
var rand = Math.random();
19-
var sizeRand;
2019
var chanceOfLargeSnowflake = 0.15;
2120

22-
if (Math.random() < chanceOfLargeSnowflake) {
23-
sizeRand = Math.random() * 0.9 + 0.1;
24-
}
25-
else {
26-
sizeRand = Math.random() * 0.1;
27-
}
28-
29-
this.size = sizeRand * 20 + 2.5;
30-
this.vel = sizeRand * 4 + 1;
31-
this.alpha = (1 - sizeRand * 0.9);
21+
this.size = 2 + Math.random() * 5;
22+
this.vel = 3 + Math.random() * 3;
23+
this.alpha = 0.5 + Math.random() * 0.8;
3224

3325
// random x position
34-
this.midX = Math.random() * maxX;
26+
this.x = Math.random() * maxX;
3527
this.y = -this.size;
3628

3729
// side-to-side movement
38-
this.sidePhase = 0;
39-
this.sideAmp = sizeRand * 40;
40-
this.sideVel = Math.random() * 0.05;
30+
this.sideVel = (0.5 - Math.random()) * this.vel;
4131

42-
this.x = 0;
4332

4433
return this;
4534
};
@@ -53,7 +42,7 @@
5342
var settleCanvasStyle = settleCanvas.style;
5443
var windowResized;
5544
var activeFlakes = [];
56-
var snowflakesPerPixelPerSecond = 0.02;
45+
var snowflakesPerPixelPerSecond = 0.05;
5746
var PIx2 = Math.PI*2;
5847
var assumedFps = 60;
5948
var settlePoint;
@@ -75,7 +64,7 @@
7564
range += xStart;
7665
xStart = 0;
7766
}
78-
else if (xStart + range > settlePoint.length) {
67+
if (xStart + range > settlePoint.length) {
7968
range -= xStart + range - settlePoint.length;
8069
}
8170

@@ -109,7 +98,7 @@
10998
activeFlakes.push( new Snowflake(canvas.width) );
11099
}
111100
}
112-
101+
113102
var i = activeFlakes.length;
114103
var flake;
115104

0 commit comments

Comments
 (0)