Show HN: I saw this mind-blowing experiment, so I made a simple version of it (opens in a new tab)github.com
403 pointsTwo browser windows (acting as socket clients) communicate their:
- Screen dimensions - (screen.width, screen.height)
- Window dimensions - (window.innerWidth, window.innerHeight)
- Window X/Y position - (window.screenX, window.screenY)
...or whichever calculation works best for you.
The original work by Bjorn Staal https://twitter.com/_nonfigurativ_/status/172732259457002734 used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends.
Here's a demo of how it works and the codebase: https://github.com/Momciloo/fun-with-sockets/
Comments (129) 42 threads
Also, thank you for voluntarily acknowledging that you were directly inspired by somebody else and giving them credit - the software industry could use more people like you.
Make your stuff from zero, like the rest of us!
I guess it's hard to accurately convey sarcasm online, thanks again!
Continue this thread — 3 replies
Here the original creator is demoing the behavior on multiple monitors
IIRC you don't even need the sockets. One can simply use message channels between the windows. If a window opens child window, iirc it has special access over it (I say special, because usually different tabs/windows are isolated from one another) which might make a local-only version easy to implement too.
You need to shoot at the window boundaries, too, or the window shrinks. Additional windows appear later in the game with boss enemies.
Gameplay video: https://youtu.be/7iP68FZWVxM
All comments shown.
Couldn't load more comments. Check your connection and try again.