cel
Flat bands of light with a hard highlight and an ink rim. The cartoon look.
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 |
|---|---|---|---|---|
cel-light | number | 120 | 0 to 360 | Light azimuth (degrees) |
cel-bands | number | 3 | 2 to 5 | Light bands |
cel-outline | number | 0.8 | 0 to 1 | Outline (0 removes it) |
Notes
Cartoon shading. Light falls in flat bands instead of a gradient, the highlight is one hard dot, and a line of ink runs along the silhouette and the grazing edges. In the dark theme the ink is a bright tint of the color; in the light theme it is a dark one.
light(0 to 360, default 120): where the key light comes from, around the view.bands(2 to 5, default 3): how many steps of light.outline(0 to 1, default 0.8): how strong the ink line is. 0 removes it and leaves only the bands and the highlight.
<sd-scene shading="cel" cel-bands="2">
<sd-star color="color(display-p3 1 0.8 0.5)"></sd-star>
</sd-scene>Put shading="cel" on a scene to shade every object in it, or on one object. Compare all shades on the Shades page.
License
MIT. Use it anywhere, credit appreciated.