datenspuren clouds.js: less number conversion
This commit is contained in:
parent
3cad78a2d7
commit
f3c823481b
|
@ -39,7 +39,7 @@ function Raindrop(x, y, speedX) {
|
|||
|
||||
this.el = $('<p class="backgroundraindrop"></p>');
|
||||
this.el.text(''+Math.floor(Math.random() * 2));
|
||||
var rotation = Math.floor(45 - (Math.random() * 90));
|
||||
var rotation = 45 - (Math.random() * 90);
|
||||
this.el.css('-webkit-transform', 'rotate('+rotation+'deg)');
|
||||
this.el.css('-moz-transform', 'rotate('+rotation+'deg)');
|
||||
this.el.css('-o-transform', 'rotate('+rotation+'deg)');
|
||||
|
@ -58,8 +58,8 @@ Raindrop.prototype.render = function() {
|
|||
this.speedY += 23 * d; /* gravity */
|
||||
this.y += this.speedY * d;
|
||||
|
||||
this.el.css('left', Math.floor(this.x)+'px');
|
||||
this.el.css('top', Math.floor(this.y)+'px');
|
||||
this.el.css('left', this.x+'px');
|
||||
this.el.css('top', this.y+'px');
|
||||
this.el.css('opacity', (this.fadeUntil - t) / this.ttl);
|
||||
|
||||
this.lastUpdate = t;
|
||||
|
@ -92,7 +92,7 @@ Cloud.prototype.update = function() {
|
|||
this.x += this.speedX * (now() - this.lastUpdate) / 1000;
|
||||
this.lastUpdate = now();
|
||||
|
||||
this.el.css('left', Math.floor(this.x) + 'px');
|
||||
this.el.css('left', this.x + 'px');
|
||||
this.el.css('top', this.y + 'px');
|
||||
|
||||
if (this.isDone())
|
||||
|
@ -127,8 +127,8 @@ function stepClouds() {
|
|||
cloud1.y < cloud2.y + 40 &&
|
||||
Math.random() < 0.01) {
|
||||
|
||||
new Flash(Math.floor((cloud1.x + cloud2.x) / 2 + 36),
|
||||
Math.max(cloud1.y, cloud2.y) + 38);
|
||||
new Flash((cloud1.x + cloud2.x) / 2 + 36,
|
||||
Math.min(cloud1.y, cloud2.y) + 38);
|
||||
cloud1.raining = true;
|
||||
cloud2.raining = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user