
react
React is a JavaScript library for building user interfaces with declarative, component-based, and cross-platform design.
它展示了无需外部依赖的创意跨窗口协作方式,将任意桌面布局变成共享游戏台面。
A tiny browser experiment where one glowing Pong ball moves across multiple real browser windows as if the desktop were one shared table.
Open the same URL in two or three separate windows, arrange them on your screen, and the ball will cross between touching windows. Empty space between windows behaves like a wall.
Browser windows from the same origin can communicate through localStorage. When one window writes to localStorage, every other open window receives a storage event.
This project uses that as a tiny message bus:
screenX, screenY, innerWidth, and innerHeight.localStorage.screenX/screenY.That means each canvas is just a viewport into one shared screen-space coordinate system.
The collision model asks one simple question: is this screen point covered by any open window? If yes, the ball can move there. If no, it bounces. This makes touching windows behave like connected rooms while gaps behave like walls.
Serve the folder over localhost. Do not open index.html directly with file://.
node server.js
Then open:
http://127.0.0.1:8000/
Use separate browser windows, not tabs.
node physics.test.js
node windowRegistry.test.js
node viewport.test.js
The tests cover the important weird parts: open-room collision, hidden tab host election, and shared screen coordinates.
index.html - full-window canvas and minimal stylingmain.js - app wiring and animation loopwindowRegistry.js - window heartbeat, cleanup, and host electionphysics.js - host-only ball physicsrenderer.js - glowing trail rendererviewport.js - shared screen-space window rectangleThis is intentionally dependency-free at runtime. It uses browser APIs, canvas, and localStorage.
The collision check probes the ball's leading edge, not its full swept circle. That is enough for normal window layouts. If you make tiny gaps or tight concave shapes, it may clip a corner.
根据分类、Topic 和编程语言匹配的相似项目。

React is a JavaScript library for building user interfaces with declarative, component-based, and cross-platform design.
A GPT‑image powered app that extracts individual garment cutouts from photos, organizes them into a digital wardrobe, and generates modeled outfit previews.
A browser-based first-person shooter built entirely with procedural generation and orchestrated AI agents, featuring 55k lines of Three.js/WebGL2 code and no art assets.