Skip to content

演示即用型 ​

这些配方使用 presets/presets 工作区中提供的官方预设(即将发布的 beta/alpha)。

模式基础开始/停止(无自动播放) ​

ts
import { tsParticles } from "@tsparticles/engine";
import type { Container, ISourceOptions } from "@tsparticles/engine";

let container: Container | undefined;

export async function start(id: string, options: ISourceOptions): Promise<void> {
  container?.destroy();
  container = await tsParticles.load({ id, options });
}

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

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

预设食谱 ​

要立即在 UI 中测试它们,请使用 Playground 并仅在需要时使用 Start 启动它们。

框架演示项目 ​

monorepo 还包括可运行的集成演示:

  • 源文件夹:https://github.com/tsparticles/tsparticles/tree/main/demo
  • 可用演示包括:angular、astro、electron、inferno、ionic、jquery、lit、nextjs、nextjs-legacy、 nuxt2、nuxt3、nuxt4、preact、react、riot、solid、svelte、svelte-kit、 vanilla、vanilla_new、vite、vue2、vue3、webcomponents。