Skip to the page
TACTILE UI

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
  1. Use it
  2. Options
  3. Methods
  4. States
  5. How it works
01

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>
02

Options

OptionTypeDefaultWhat it does
contentword · lamp · image'word'A word with a lamp behind it, a lit numeral, or your image.
texttext'Quiet hours'Word or number
captiontext'Deploys pause at 22:00'Caption
imagetext''Shown when "Behind the glass" is image. Same origin, or served with CORS.
glowvfd · amber · green'vfd'The lit numeral: a vacuum-fluorescent cyan-white, or an amber or green lamp.
reedsnumber, 6 to 4814Reed width (px)
depthnumber, 0.2 to 1.20.8How strongly each reed bends what is behind it.
tintclear · green · smoke'green'Clear, the faint green of float glass, or smoke.
opennumber, 0 to 1000Where the pane rests. Slide it by its pull in the preview.
slidebooleantrueSlides by hand
finishauto · aluminium · graphite'auto'The rails and the pull, and the word’s ground. Auto follows the page’s data-finish.
lightnumber, 0 to 345315Where each reed’s highlight sits.
labeltext''What is behind the glass, for people who cannot see it. Empty: the caption and word.
03

Methods

new ReededGlass(element, options)
Builds it inside the element with these options.
value
How far open, 0…1, as it stands.
renderer
update(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.

04

States

  1. 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.
  2. 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.
  3. 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.
  4. HoverOn a mouse, your eye moves with the pointer: the strips slide inside the reeds; leaving, they settle back.
  5. 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.
  6. A wordA word and its caption on the page's ground with a warm lamp behind them, which the reeds pull into bright columns.
  7. A numeralA number glowing like a vacuum-fluorescent display, or an amber or green lamp, broken into glowing strips.
  8. An imageYour image, cover-fit behind the pane.
  9. No WebGL2A canvas slices the content column by column at each reed's shift and lays the reeds' light over it.
  10. Off screen or hiddenIt draws nothing.
  11. Reduced motionThe pane jumps to open or shut; the eye stays put.
05

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.

Docs
Finish
Volume