r/node • u/jaymeekae • Aug 05 '20
Multi-user interactive visuals with nodejs and p5js (work in progress!)
3
u/loudlyClear Aug 05 '20
Didnt know that this was also possible. Great work !
7
u/jaymeekae Aug 05 '20
Thanks! This is the tutorial series I used to get started with websocket/nodejs:
3
2
u/oleic Aug 05 '20
wow this is cool :) is the visualization also synchronized between the devices over network?
2
u/jaymeekae Aug 05 '20
Users get paired up in twos and then whenever one of them draws, it sends the new points to their partner. It sends the points' location, colour, direction, pen thickness etc. Then each client handles the animation from then on.
Rotation currently will get a bit out of sync due to differences in framerate on different machines, I'm thinking about how I could adjust rotation speed so it's based on millis somehow but need to experiment because it might be a huge faff, or it might make things jittery, not sure yet.
2
u/sldomingo Aug 05 '20
I discovered P5JS thanks to The Coding Train, and I had fun with it for a year or so. Soon I discover tho that is not meant for complicated stuff since it is not very well optimized and it's very evident on mobile. If you want to get crazy on the frontend try Three.JS. It is way more complicated but you can really make amazing stuff with it.
1
u/jaymeekae Aug 05 '20
Yeah I tried threejs on my last project but it created more problems than it solved. I'll have a look again in the future.
1
u/vadeka Aug 05 '20
Yeah threejs is overwhelming to even start in
1
u/jaymeekae Aug 05 '20
I realised after posting the above comment that actually it was pixijs that i tried last time.
I had a look into threejs just now and went through some of the tutorial book on their website but I don't really think it's appropriate to use here. This is a path (well, a "shape", in p5js language) drawn on a 2D canvas and I can't really see how to do that in threejs.
2
u/x___tal Aug 05 '20
Man this is cool! Good luck!
1
1
Aug 06 '20
Haha I can hear the laptop fans spinning from here. Great work!
1
u/jaymeekae Aug 06 '20
Haha, it's actually not toooo bad unless I'm screenrecording it. It works on mobile too :)
2
2
2
2
2
2
2
26
u/[deleted] Aug 05 '20
I didn't know I wanted LSD at 8:20 on a Wednesday morning, but now I think I do.
This is really awesome, great work!