@tsparticles/effect-bubble
Version:
tsParticles bubble effect
27 lines (26 loc) • 1.01 kB
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BubbleDrawer = void 0;
const engine_1 = require("@tsparticles/engine");
const bubbleFactor = 3;
class BubbleDrawer {
draw(data) {
const { context, radius } = data, bubbleRadius = radius / bubbleFactor;
context.beginPath();
context.arc(bubbleRadius, -bubbleRadius, bubbleRadius, engine_1.defaultAngle, engine_1.doublePI, false);
context.closePath();
context.fillStyle = "#fff9";
context.fill();
}
}
exports.BubbleDrawer = BubbleDrawer;
});