Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render issue #28

Open
Stalh opened this issue Jun 15, 2023 · 1 comment
Open

Render issue #28

Stalh opened this issue Jun 15, 2023 · 1 comment

Comments

@Stalh
Copy link

Stalh commented Jun 15, 2023

Hello, thank you for the library.

I've encountered a bug and I confess I don't really know how to explain the problem but I'll try to show it (it's my first issue).
The problem is simple when I want to make particles appear in the background of the "body" it works but it does not extend to the entire body and it does not appear on the last two sections of the "body". What I don't understand is that when I use "inspect element", it works as if it reloads the effect and applies it again.

Thanks in advance for the answer and sorry if I wasn't clear enough!

Pictures:
[Before
AVANT_1
AVANT_3
]

[After "nspect element"
APRES
]

@Stalh Stalh changed the title R Render issue Jun 15, 2023
@simeydotme
Copy link
Owner

simeydotme commented Jun 16, 2023

Ah, hi @Stalh thanks for opening this issue!

I do believe though, this is not a bug or other with the Sparticles really.. let me explain.

The particles exist on a canvas element, and you've elected to sit it in the background of the page. One of my main goals with this is high performance and no lag/jank. One of the major causes of jank is things moving or changing size, and also running a constant thread/loop to listen for changes. Therefore I am only updating the size of the canvas when the window changes size only. And it just so happens that opening the Dev Tools causes the window to change size, triggering the canvas to re-calc.

Now the question is why is it wrong size in the first place?

My hunch is that you're running some kind of client side library/framework which is loading the canvas (particles) and then adding new elements to the page (or toggle hide/show) ?

The easiest way to solve this is to call the Sparticles after you have finished rendering your page elements , another solution is to manually update the canvas size with the document.body.height and document.body.width as described here https://github.com/simeydotme/sparticles#setCanvasSize after your new page elements are loaded

Let me know if that helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants