-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Push particles based on variable change in a seperate function #504
Comments
I've created this sample: https://codesandbox.io/s/loving-http-ld9nbv?file=/src/index.js It adds a custom class handled when |
Hi Matteo, I also came across this other method of updating things which works like this: Every time particleRefresh() is triggered, the whole view resets with the new values, I was wondering if there would be something like particlesUpdate() to take the existing view and add the new values. There must be a way because if I don't use particleRefresh and a different part of my loop is called and I then click into the existing view, it changes the color of all existing particles and pushes new particles instead of refreshing the whole view (I hope this makes any sense) I put it into a loop in my WebSocket, maybe this can give you a bit of an overview:
Let me know ig you have any idea or maybe I should open a new thread with this? |
It looks like you can add new particles to the existing view using this method (example below adding 20 particles at position 100, 100).. pJSDom[ 0 ].pJS.fn.modes.pushParticles( 20, { pos_x: 100, pos_y: 100 } ) If you want to set a different colour for the new particles, make this call first (i.e. setting to green).. pJSDom[ 0 ].pJS.particles.color={rgb: { r:0, g:255, b:0 }, value:'#00ff00'} |
Hi there, not expecting much help from here but I'll give it a shot anyway:
I'm using WebSockets to retrieve a number that changes every now and then in my project. I have added it to Particles.js and assigned a variable to the changing number.
Next, I can use that Variable to set how many particles are pushed on click. But this variable only updates once at the beginning and then doesn't register the changes coming from my WebSockets.
I was wondering if there is a way, to push new particles based on the number I am getting from my WebSockets instead of having to click.
So in Theory, my particles.js receives data via my WebSocket connection, I store this data as an int, and depending on the int new particles are added or reduced from the canvas. Everytime new data comes via WebSocket this process is repeated.
Any hints or Ideas how I could get something like this done ?
The text was updated successfully, but these errors were encountered: