tsparticles / react

React tsParticles official component
https://particles.js.org
MIT License
357 stars 24 forks source link

particles cover the whole page, i want it to only cover my hero component but its covering the whole page, im using next js #100

Closed Rico-proxy closed 3 months ago

Rico-proxy commented 3 months ago

issue2 issue1

i want it to only cover the black background image but its stretchin over

this my code below for my hero component "use client" import React from 'react'; import { useCallback } from "react"; import Particles from "react-tsparticles"; //import { loadFull } from "tsparticles"; // if you are going to useloadFull, install the "tsparticles" package too. import { loadSlim } from "tsparticles-slim"; // if you are going to useloadSlim`, install the "tsparticles-slim" package too. import Image from 'next/image';

const Hero = () => { const particlesInit = useCallback(async engine => { console.log(engine); // you can initiate the tsParticles instance (engine) here, adding custom shapes or presets // this loads the tsparticles package bundle, it's the easiest method for getting everything ready // starting from v2 you can add only the features you need reducing the bundle size //await loadFull(engine); await loadSlim(engine); }, []);

const particlesLoaded = useCallback(async container => { await console.log(container); }, []); return (

Buy And Sell Digital Currency

Bitcoins work just like obtaining any other currency. You can buy and sell them, and that is the future.

Digital Currency

); };

export default Hero; `

and this my page.js ` import Hero from "@/components/website/Hero"; import HowItWorks from "@/components/website/HowItWorks";

export default function WebPage() { return (

);

}`

matteobruni commented 3 months ago

https://www.reddit.com/r/tsParticles/comments/w8luvb/why_my_particles_are_full_screen_i_want_them_to/