14Object 14 · Reveals
Reeded Glass
A pane of fluted glass on rails. Each reed is a lens that magnifies what is behind and smears it softly sideways, sharp top to bottom, so a word reads from across the room. Slide it aside by its pull and the content is there.
- Version
- 0.1.0
- Size
- 11.7 KB gzipped
- Access
- With a Pass
- Needs
- reeded-glass.mjs + reeded-glass.css
- Tests
- 7 tests · 11 states
On this page
Use it
Content behind real optics. A hero where the product shot or the headline sits behind ribbed glass; a status numeral glowing through it like a clock radio's display; a locked preview (a dashboard image, a price, a result) that a signed-in visitor slides open; a quiet-hours or maintenance notice that is present without shouting. The pull is a slider (0–100 % open) that keyboards open and shut, and what is behind the glass is always in the accessible name.
Copy the reeded-glass folder from its package next to your page, link its stylesheet and construct it on an element. Every option has a default; the lab’s Code tab writes the same example at any settings, and for React, Vue, Svelte or a custom element (Using a framework).
<link rel="stylesheet" href="reeded-glass/reeded-glass.css">
<div id="reeded-glass" style="width: min(92vw, 880px)"></div>
<script type="module">
import ReededGlass from './reeded-glass/reeded-glass.mjs';
const reededGlass = new ReededGlass(document.getElementById('reeded-glass'), {
content: 'word',
text: 'Quiet hours',
caption: 'Deploys pause at 22:00',
});
// reededGlass.update({ … }); change any option in place
// reededGlass.destroy(); and take it away again
</script>Options
| Option | Type | Default | What it does |
|---|---|---|---|
| content | word · lamp · image | 'word' | A word with a lamp behind it, a lit numeral, or your image. |
| text | text | 'Quiet hours' | Word or number |
| caption | text | 'Deploys pause at 22:00' | Caption |
| image | text | '' | Shown when "Behind the glass" is image. Same origin, or served with CORS. |
| glow | vfd · amber · green | 'vfd' | The lit numeral: a vacuum-fluorescent cyan-white, or an amber or green lamp. |
| reeds | number, 6 to 48 | 14 | Reed width (px) |
| depth | number, 0.2 to 1.2 | 0.8 | How strongly each reed bends what is behind it. |
| tint | clear · green · smoke | 'green' | Clear, the faint green of float glass, or smoke. |
| open | number, 0 to 100 | 0 | Where the pane rests. Slide it by its pull in the preview. |
| slide | boolean | true | Slides by hand |
| finish | auto · aluminium · graphite | 'auto' | The rails and the pull, and the word’s ground. Auto follows the page’s data-finish. |
| light | number, 0 to 345 | 315 | Where each reed’s highlight sits. |
| label | text | '' | What is behind the glass, for people who cannot see it. Empty: the caption and word. |
Methods
new ReededGlass(element, options)- Builds it inside the element with these options.
value- How far open, 0…1, as it stands.
rendererupdate(opts = {})- Change options in place.
open()close()toggle()destroy()- Stops it and cleans up after it.
Events it fires, which bubble from the element: change, input.
States
- ShutThe content behind the reeds: sliced into flipped strips, smeared sideways, sharp top to bottom, each reed lit by the room lamp and dark in its valley.
- SlidingDrag the pull: the pane follows the hand with no lag; where it has gone the content is sharp, and the slab's green edge runs along the join.
- Let goIt runs to open or shut, whichever it is nearer to or was flung toward, on a spring, and stops softly against the rails.
- HoverOn a mouse, your eye moves with the pointer: the strips slide inside the reeds; leaving, they settle back.
- KeyboardThe pull is a slider: Enter or Space opens and shuts it, arrows move it by a tenth, Page keys by a quarter, Home and End go to the ends.
- A wordA word and its caption on the page's ground with a warm lamp behind them, which the reeds pull into bright columns.
- A numeralA number glowing like a vacuum-fluorescent display, or an amber or green lamp, broken into glowing strips.
- An imageYour image, cover-fit behind the pane.
- No WebGL2A canvas slices the content column by column at each reed's shift and lays the reeds' light over it.
- Off screen or hiddenIt draws nothing.
- Reduced motionThe pane jumps to open or shut; the eye stays put.
How it works
Made of: Cylindrical reed lens, Sideways defocus, Reed dispersion, Room fixed sheen, Sliding pane detents, Eye parallax, Single pass shader, Canvas fallback, Sleeping loop.
Original. One WebGL2 fragment pass over a content texture drawn in a 2D canvas; a column-slicing canvas fallback. Nothing loops at rest.