knot
A glassy torus knot: one tube that winds around a ring and through itself.
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 |
|---|---|---|---|---|
twist | float | 3 | 1 to 5 | Twists (lobes seen from the front) |
thickness | float | 0.09 | 0.04 to 0.15 | Tube thickness |
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 glass tube that runs twice around a ring and winds through itself on the way. With three twists it is a trefoil, the simplest true knot. It rewards a slow spin: the crossings slide over each other.
twist(1, 3 or 5, default 3): how many times the tube winds around the ring, which is the number of lobes you see from the front. 1 is a plain ring, 3 a trefoil, 5 a cinquefoil.thickness(0.04 to 0.15, default 0.09): tube radius.
<sd-scene>
<sd-knot color="color(display-p3 0.78 0.66 1)" animation="spin" speed="0.4"></sd-knot>
</sd-scene>
License
MIT. Use it anywhere, credit appreciated.