#Have anyone gotten ts particles to work in solid?

1 messages · Page 1 of 1 (latest)

sharp remnant
amber flax
#

What does not work? Were there any error messages?

Maybe let's start with resolving the red underline errors in your code? You probably need to import the appropriate functions

import { loadFull } from "tsparticles";
import Particles, { initParticlesEngine } from "@tsparticles/solid";
#

Seems like the README.md might be a bit outdated

#

If you check the example app they have under the apps/solid folder in the repo, this seems like the new recommended approach https://github.com/tsparticles/solid/blob/main/apps/solid/src/App.tsx

import configs from "@tsparticles/configs";
import type { Component } from 'solid-js';
import { createSignal, Show } from "solid-js";
import { loadFull } from "tsparticles";
import Particles, { initParticlesEngine } from "@tsparticles/solid";

const App: Component = () => {
  const init = initParticlesEngine(loadFull)
  const [config, setConfig] = createSignal(configs.basic)

  setTimeout(() => setConfig(configs.absorbers), 1000)

  return (
    <Show when={init()}>
      <Particles id="tsparticles" options={config()}/>
    </Show>
  );
};

export default App;
GitHub

Solid.js tsParticles official component. Contribute to tsparticles/solid development by creating an account on GitHub.

rotund gulch
sharp remnant
sharp remnant
rotund gulch
#

restart the dev server is sometimes needed w vite

#

a wait no, mb i m wrong let me check

#

ye i misremembered. the published version is not the same as the version on github. and something is blocking it being published.

#

i am not sure what exactly

sharp remnant