UNPKG

party-js

Version:

A JavaScript library to brighten up your user's site experience with visual effects!

37 lines (36 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Particle = void 0; var components_1 = require("../components"); var config_1 = require("../util/config"); /** * Represents an emitted particle. */ var Particle = /** @class */ (function () { /** * Creates a new particle instance through the specified options. */ function Particle(options) { var populatedOptions = config_1.overrideDefaults({ lifetime: 0, size: 1, location: components_1.Vector.zero, rotation: components_1.Vector.zero, velocity: components_1.Vector.zero, color: components_1.Color.white, opacity: 1, }, options); // Generate a symbolic ID. this.id = Symbol(); // Assign various properties, together with some initials for later reference. this.size = this.initialSize = populatedOptions.size; this.lifetime = this.initialLifetime = populatedOptions.lifetime; this.rotation = this.initialRotation = populatedOptions.rotation; this.location = populatedOptions.location; this.velocity = populatedOptions.velocity; this.color = populatedOptions.color; this.opacity = populatedOptions.opacity; } return Particle; }()); exports.Particle = Particle;