Scene and gravity

Objects inside one scene share a canvas and can react to each other. Pick which object is the center of gravity.

How a scene works

A scene is a block element that owns one canvas covering its own box. Its children are placed with ordinary CSS, and each object renders centered on its layout box. Interactions may move an object visually without touching the layout, so your page never reflows.

Gravity

Orbiters take concentric rings: they are sorted by how far the layout puts them from the center, the nearest ring keeps clear of the center, the farthest sits at the farthest rest distance, and the rings in between are spread evenly. A ring turns at a speed that falls with its radius to the power 1.5, so the outer ring sets the pace and inner rings pass it, the way planets do.

AttributeTypeDefaultRangeDescription
gravitykeywordorbitcenter, orbit, fall, noneOn an object: its role. Exactly one center; extra centers orbit. Orbiters sit on rings, one each, farther rings turning slower.
gravity-strengthnumber0.60 to 1On the scene: orbital speed and pull. At 1 the outer ring turns once every 21 seconds.
gravity-gapnumber240 to 200On a falling object: distance it keeps from the center, in px.

License

MIT. Use it anywhere, credit appreciated.