This project demonstrates a real-time, cross-context visual simulation. It allows independent browser windows to share a single coordinate space, creating a seamless environment where particles (snowflakes) flow between separate windows and tabs as if they were part of a single physical display
Click the image to watch the synchronization in action.
The application uses an HTML5 Canvas rendering engine combined with the Broadcast Channel API to synchronize state across multiple browsing contexts. By mapping local window coordinates to a global screen-space grid, the script ensures that a particle leaving one window enters another at the exact physical location on the user’s monitor.
window.screenX and window.screenY to calculate a shared coordinate system.The Broadcast Channel API is a low-latency, many-to-many communication bus. It allows different browsing contexts (tabs, windows, frames, or workers) that share the same Origin (protocol, domain, and port) to send messages to one another without a backend server or complex signaling logic.
Unlike other communication methods, the Broadcast Channel API is:
window.postMessage), making it ideal for decoupled architectures.The Broadcast Channel API can be utilized in any of the following contexts:
A critical feature of this implementation is the Instance ID system. To prevent Message Feedback Loops—where Window A sends a message, and Window B receives it and accidentally re-broadcasts it—each window generates a unique ID on startup.
Every message includes this ID. When a window receives a message, it checks the ID:
This ensures a stable, one-way flow of information to every peer in the network.
Download the /src directory with index.html and blizzard.js contained to your local machine or a web server, load up index.html in 2 or more browsers and move your mouse between them
https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API