UNPKG

@tehnoskarb/xn-snowflakes

Version:

Add beautiful falling down snowflakes to any of the elements container (or fullscreen) in your webpage.

25 lines (24 loc) 728 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Snowflake = /** @class */ (function () { function Snowflake() { this.x = 0; this.y = 0; this.vx = 0; this.vy = 0; this.r = 0; this.o = 0; this.sleep = false; } Snowflake.prototype.reset = function (width, height) { this.x = Math.random() * width; this.y = Math.random() * (height < 100 ? -800 : -height); this.vy = 1 + Math.random() * 3; this.vx = 0.5 - Math.random(); this.r = 1 + Math.random() * 2; this.o = 0.5 + Math.random() * 0.5; this.sleep = false; }; return Snowflake; }()); exports.Snowflake = Snowflake;