prism
A glass prism with flat faces and crisp edges, from a triangle to an octagon.
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 |
|---|---|---|---|---|
sides | float | 6 | 3 to 8 | Sides |
height | float | 0.8 | 0.3 to 1.2 | Height |
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 prism: a flat polygon pulled up into a column, tipped toward you so the top face shows. Three sides make a classic triangular prism, six a hexagonal nut, and a low height turns it into a tile.
sides(3 to 8, default 6): number of side faces.height(0.3 to 1.2, default 0.8): height of the column.
<sd-scene>
<sd-prism color="color(display-p3 0.55 0.85 1)" sides="3" animation="idle"></sd-prism>
</sd-scene>
License
MIT. Use it anywhere, credit appreciated.