ring
A glassy torus, tilted toward the viewer. Spin it, or put it in orbit around something.
Add the script once, then use the tags anywhere.
<script type="module" src="https://mmaxence.github.io/solids/solids.js"></script>
Or copy the library into your project: download solids.js from the repo and serve it yourself. No build step, no other files.
Options
| Attribute | Type | Default | Range | Description |
|---|---|---|---|---|
thickness | float | 0.16 | 0.05 to 0.5 | Tube thickness |
tilt | float | 0.55 | 0 to 1 | Tilt toward the viewer |
rim | float | 1 | 0 to 2 | Fresnel rim |
color | color | #9bd1ff | any CSS color, including color(display-p3 r g b) | Accent color of the object. |
size | length | 160px | any CSS length | Width and height of the object box. |
animation | list | none | idle, spin, pulse, breathe, float | Space separated animations, composed in order. |
speed | number | 1 | 0.1 to 3 | Multiplies animation time. |
state | keyword | idle | off, idle, busy, active | Brightness level, eased on change. |
effect | list | none | glow, beam, rgb-split, pixelate, dither, scanlines, halftone, outline, grain, vignette, chroma, ripple, defocus | Space separated post effects on this object only. |
shading | keyword | auto | auto, glass, matte, cel, clay, metal | How the surface takes light. auto is glass in the dark theme and matte in the light one; a scene's shading is the default for its children. |
gravity | keyword | orbit | center, orbit, fall, none | Role in a gravity scene. |
Notes
A glassy torus tilted toward the viewer. It reads well spinning on its own, and as a satellite orbiting a center object in a gravity scene.
thickness(0.05 to 0.5, default 0.16): tube radius relative to the ring.tilt(0 to 1, default 0.55): how far the ring leans toward the viewer. 0 is edge-on, 1 is flat.rim(0 to 2, default 1): fresnel edge brightness.
<sd-scene>
<sd-ring color="color(display-p3 0.78 0.66 1)" animation="spin" speed="0.6"></sd-ring>
</sd-scene>
License
MIT. Use it anywhere, credit appreciated.