Skip to content

バブルのプリセット

presets/presets/bubbles ワークスペースからの公式プリセット。

インストール

bash
pnpm add @tsparticles/engine @tsparticles/preset-bubbles

すぐに使用可能 (手動開始/停止)

ts
import { tsParticles } from "@tsparticles/engine";
import { loadBubblesPreset } from "@tsparticles/preset-bubbles";
import type { Container } from "@tsparticles/engine";

let container: Container | undefined;

await loadBubblesPreset(tsParticles);

export async function start(): Promise<void> {
  container?.destroy();

  container = await tsParticles.load({
    id: "tsparticles",
    options: {
      preset: "bubbles",
    },
  });
}

export function stop(): void {
  container?.pause();
}

export function resume(): void {
  container?.play();
}

動きがより目に見えるインタラクティブなセクションに役立ちます。