The hovering event trail feature is not functioning in tsParticles, unlike in particlejs

I have two questions regarding the implementation of tsParticles in my React application. First question:

<Particles 
        id="tsparticles"
        options={{
          background: {
            color: {
              value: "black",
            },
          },
          fpsLimit: 60,
          interactivity: {
            detectsOn: "window",
            events: {
              onClick: {
                enable: true,
                mode: "push",
              },
              onHover: {
                
                enable: true,
                mode: "trail",
              },
              resize: true,
            },
            modes: {
              bubble: {
                distance: 400,
                duration: 2,
                opacity: 0.8,
                size: 40,
              },
              push: {
                quantity: 4,
              },
              repulse: {
                distance: 200,
                duration: 0.4,
              },
            },
          },
          particles: {
              
            color:{
                animation:{
                    enable:true,
                    speed:50,
                },
                value:"#f00"
            },
            links: {
                shadow:{
                    blur:true,
                    color:"#00ff00"

                },
                triangles:{
                    frequency: 1
                },
              color: "random",
              distance: 150,
              enable: true,
              frequency:1,
              opacity: 0.5,
              width: 1,
            },
            collisions: {
              enable: true,
            },
            move: {
                angle:{
                    offset: 45,
                    value: 90
                },
                attract:{
                    rotate:{
                        x:3000,
                        y:3000
                    }
                },
                gravity:{
                    acceleration: 9.81,
                    enable:false,
                    maxSpeed:1
                },
              direction: "none",
              enable: true,
              outMode: "bounce",
              random: false,
              speed: 6,
              straight: false,
            },
            number: {
              density: {
                enable: true,
                value_area: 1000,
              },
              value: 80,
            },
            opacity: {
              value: 0.5,
            },
            shape: {
              type: "circle",
            },
            size: {
              random: true,
              value: 5,
            },
          },
          detectRetina: true,
        }}
      /> 

There is a section for onHover with a key "mode" containing 8 different modes, which can be found on https://particles.matteobruni.it/. All other modes are functioning correctly except for the trail mode when using this code. Are there additional properties required for the Particles component?

Second question: Additionally, I have two div elements - one for the particles and another for text to display on top of them. I've achieved this using z-index and positioning.

I am looking to make the canvas height dynamic, occupying 100% height of its parent regardless of screen size. I attempted this by placing the Particles component within a div with a height set to 100%, but the canvas height decreases as the screen size shrinks.

Your assistance would be greatly appreciated. Thank you :)

Answer №1

Impressive! There's a plethora of information to cover here, but I'll do my utmost.

To begin with, let's talk about the config and mouse trail

In order to tailor the mouse trail to your liking, delve into the modes section within interactivity, where you can adjust the trail settings.

A demo is available here for reference: https://codepen.io/matteobruni/pen/abdpbBY

If more guidance is required, consult the appropriate documentation section:

Moving on to the second point, addressing canvas size

For a dynamically adjustable canvas size, employing the backgroundMode in the root options object proves most effective.

You can view an example here: https://codepen.io/matteobruni/pen/MWeqxNL

Enabling the background mode will establish the canvas style with a fixed position and the specified zIndex

Refer to the documentation provided here for further insights:

When utilizing the backgroundMode, it is recommended not to apply any styles to the encompassing div (the tsParticles target/container) for optimal results.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I retrieve the attributes of multiple identical components within a webpage?

I've recently delved into learning Vue and decided to create a small application for adding fractions together. I have developed two main components: Fraction.vue and App.vue. The App.vue component contains multiple instances of the Fraction component ...

Trouble with setting backgroundColor in Material UI components

Recently, I encountered an issue with my code that changes the background color of my grid. It was working fine before, displaying a black background, but now it suddenly turns white and I can't seem to alter the root element's background color. ...

What is the best way to populate a div with multiple other div elements?

My current project involves creating a sketchpad using jQuery for an Odin Project assignment. However, I have encountered an issue with filling the canvas (wrapper div) with pixels (pixel divs). The canvas does not populate correctly. Here is the link to m ...

Guide on making a prev/next | first/last button functional in list.js pagination

Is there a way to enhance my paginated index by adding prev/next, first/last buttons? I am curious if anyone has implemented these features using List.js. <script src='//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js&ap ...

Oops! An error has occurred stating the need for a queue. This issue may be a result of a bug in React. Please report this problem by

Only encountering this error on the production environment, while everything runs smoothly on my local development machine using yarn dev. The issue seems to be related to the react-query hook useQuery. The error is happening within the component where th ...

No content appears on the multi-form component in React

After several attempts at building a multi-step form in React, I initially created a convoluted version using React.Component with numerous condition tests to determine which form to display. Unsatisfied with this approach, I decided to refactor the code f ...

What causes block elements to act like inline elements?

:target { border: 2px solid #D4D4D4; background-color: #e5eecc; } .navigation li { list-style-type: none; float: left; padding: 1em; } <ul class="navigation"> <li> <a href="#help"> Help </a> </li> <li> & ...

Using NodeJS and Express together with Ajax techniques

I am currently developing a web application that utilizes Ajax to submit a file along with some form fields. One unique aspect of my form is that it allows for dynamic input, meaning users can add multiple rows with the same value. Additionally, the form i ...

Unleash the power of jQuery by incorporating the Ajax functionality with a hover option to enhance user interactivity. Utilize the .ajax

On my website, I have a calendar displayed with dates like "11/29/2014" stored in an attribute called "data-date". The goal is to check the server for a log file corresponding to that date and change the CSS of the div on mouse hover. Here is the current ...

Sending information retrieved from a child component to a parent component in Next.js

In my upcoming project built with Next.js, I have three main components: Home, Pagination, and DataTable. The data fetching process from the database is handled inside the DataTable component, which essentially displays a table. Currently, I've creat ...

What makes the select box transition in React Material UI stand out?

Why does the select box move up instead of being on the same level as the input field? If you'd like to see my code, click here. For more information, visit the following links: Material-UI Selects Demo https://i.stack.imgur.com/7WtGr.png https://i ...

Is there a tool that can help pinpoint the original collection for shared elements across multiple collections?

When given multiple collections/arrays, I am interested in identifying the common elements and which collections they belong to. This request is somewhat similar to this query, but there may be matching elements between collection1 and collection3, or eve ...

The error message "TypeError: Attempted to access property 'choice' on a null object within Gatsby Link State" is being

When I click on the submenu from the dropdown navbar, I'm trying to add a ClassName dynamically. Here is how the navbar looks like: The code was working fine before but after restarting Gatsby development, an error occurred: TypeError: Cannot read pr ...

The local server for handling HTTP requests has ceased to operate

Recently, I set up the NPM package along with the http server within the "server" directory. Initially, everything was functioning smoothly; however, the server abruptly ceased operating. Upon attempting to launch the local http server, an error message a ...

What is the best way to implement an OR filter in the DevExtreme React Grid Table using either FilteringState, LocalFiltering, or a

According to a past issue #499 that is now closed on the devextreme-reactive github repository, I am interested in implementing compound filtering functionalities within the Grid/TableView components. Currently, there are two examples of filtering compone ...

What is the best way to trim a string property of an object within an array?

I am seeking a solution to access the "description" property of objects within an array and utilize a string cutting method, such as slice, in order to return an array of modified objects. I have attempted using for loops but have been unsuccessful. Here ...

What is the reason behind Meteor automatically updating a record without the need to run a "Meteor.call" function for an update?

I am currently developing a Meteor.js application and while I have grasped the basic concepts of Meteor, I feel like I might be missing something when it comes to its reactivity principles. Using angular-meteor, I am utilizing a $scope variable in my view ...

Using string replacement for effective search finding: Unleashing the power of substring matching

I have a method that adds an anchor tag for each instance of @something. The anchor tag links to a specific sub URL. Check out the code: private createAnchors(text: string) { return text.replace(/(@[^ @]+)/ig, '<a href="/home/user/$1">$1& ...

The window.addEventListener function is failing to work properly on mobile devices

Hey there! I am facing an issue in my JS code. I wrote this code because I want the menu to close when a visitor clicks on another div (not the menu) if it is open. The code seems to be working fine in developer tools on Chrome or Firefox, but it's no ...

Issue alert before running tests on component that includes a Material UI Tooltip

This is a follow-up regarding an issue on the Material-UI GitHub page. You can find more information here. Within my Registration component, there is a button that is initially disabled and should only be enabled after accepting terms and conditions by ch ...