r/node • • Aug 05 '20

Multi-user interactive visuals with nodejs and p5js (work in progress!)

458 Upvotes

25 comments sorted by

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!

2

u/jaymeekae Aug 05 '20

Haha what an endorsement

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:

https://www.youtube.com/watch?v=bjULmG8fqc8

3

u/palex25 Aug 05 '20

Ahh yess The Coding Train, his positivity is contagious.

2

u/jaymeekae Aug 05 '20

I'd literally be lost without him haha

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

u/jaymeekae Aug 05 '20

I'm a woman, but thanks!

7

u/x___tal Aug 05 '20

Woman this is cool! Good luck!*

1

u/[deleted] 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

u/Sphism Aug 05 '20

Great work

2

u/ArTooDeeTooTattoo Aug 05 '20

This is beautiful!

2

u/[deleted] Aug 05 '20

Oooh, this seems like it would be really cool tech for performance art in a theatre.

2

u/corona-survivor Aug 05 '20

Jesus this looks fresh

2

u/SnowConePeople Aug 05 '20

Magic fruit roll ups

2

u/OkoHaozu Aug 05 '20

wow, awesome!

2

u/pmlzoe Aug 05 '20

Girl this is awesome. Great job!