@tsparticles/effect-bubble
Version:
tsParticles bubble effect
13 lines (12 loc) • 433 B
JavaScript
import { defaultAngle, doublePI } from "@tsparticles/engine";
const bubbleFactor = 3;
export class BubbleDrawer {
draw(data) {
const { context, radius } = data, bubbleRadius = radius / bubbleFactor;
context.beginPath();
context.arc(bubbleRadius, -bubbleRadius, bubbleRadius, defaultAngle, doublePI, false);
context.closePath();
context.fillStyle = "#fff9";
context.fill();
}
}