01Object 01 · Surfaces
Pin Screen
The pin-art toy, as a surface. Press a word through polished pins under a raking lamp, drag it, wipe it, or shake it flat. Your hand is the mould.
- Version
- 0.1.0
- Size
- 18.0 KB gzipped
- Access
- With a Pass
- Needs
- pin-screen.mjs + pin-screen.css
- Tests
- 23 tests · 10 states
Use it
Give a hero, a cover, a 404 or a launch something to touch before anything is read: the name stands out of the board the way a hand stands out of the real toy, and the visitor presses it, wipes it or leaves their own print in it.
Copy the pin-screen 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="pin-screen/pin-screen.css">
<div id="pin-screen" style="width: min(92vw, 1100px); height: min(64vh, 520px); border-radius: 16px"></div>
<script type="module">
import PinScreen from './pin-screen/pin-screen.mjs';
const pinScreen = new PinScreen(document.getElementById('pin-screen'), {
text: 'TACTILE',
shape: 'text',
finish: 'steel',
});
// pinScreen.update({ … }); change any option in place
// pinScreen.destroy(); and take it away again
</script>Options
| Option | Type | Default | What it does |
|---|---|---|---|
| text | text | 'TACTILE' | The word behind the board. Empty is a plain board that takes the shape of whatever presses it. |
| shape | text · hand · mark | 'text' | The word, an open hand or a round mark. In code, any image or canvas works too. |
| finish | steel · brass · ink · chalk | 'steel' | Finish |
| frame | machined · acrylic · none | 'machined' | Frame |
| hold | boolean | true | Like the toy, the shape stays up. Off: it appears only under the hand. |
| keep | boolean | false | What the hand presses stays until the board is shaken flat. |
| pointer | lift · wipe | 'lift' | Lift pushes pins out from behind; wipe presses them back flat from the front. |
| pitch | number, 8 to 24 | 12 | The largest pitch. Small boards go finer so the relief stays legible. |
| pinSize | number, 0.4 to 0.95 | 0.85 | Head diameter as a share of the pitch. |
| radius | number, 40 to 240 | 130 | Hand radius (px) |
| depth | number, 0.2 to 1 | 0.7 | Relief depth |
| memory | number, 0 to 1 | 0.45 | How long a stroke stays when the impression is not kept. 0 lets go at once; 1 holds for seconds. |
| light | number, 0 to 345 | 315 | 0 is from above, clockwise. |
| intro | boolean | true | The relief comes up through the pins when the board first comes into view. |
| arrival | wave · press | 'wave' | A wave that reads left to right, or deepest first, like a hand pushed in from behind. |
Methods
new PinScreen(element, options)- Builds it inside the element with these options.
update(opts = {})- Change options in place.
replay()- Press the relief in again: the pins fall flat, then the shape comes up through them.
reset()- Shake the board flat, like tilting the toy: every pressed pin lets go, then the relief presses back in.
pressAt(nx, ny, strength = 1)- Press at a point given as fractions of the board (0…1).
statedestroy()- Stops it and cleans up after it.
States
- ArrivingWhen the board is first 30% visible the relief presses in from behind: a left-to-right wave, or deepest first (arrival: press), standing within a second; a webfont relief waits for its face.
- At restThe relief stands proud under the lamp (hold), the flush field sparkles; the loop is asleep and costs nothing.
- Hand over itPins under the pointer spring out (lift) or are pressed back flat (wipe); raised pins brighten, show their shafts and cast shadows away from the lamp.
- RememberingWithout keep, pressure decays with a half-life set by memory, so a stroke lingers and lets go.
- Impression keptWith keep, whatever the hand pressed stays until reset(); the loop still sleeps once the pins settle.
- Shaken flatreset() drops every pin top to bottom in 0.3 s, then the relief presses back in.
- Off screen or hiddenThe loop pauses; a returning tab cannot launch the springs with a long frame.
- ResizedRebuilt at the new size, pitch refitted so the relief stays legible; a relief that had arrived is simply there.
- PhoneSmall boards get finer pins so the word stays at least ten pins tall; pan-y keeps vertical scrolling.
- Reduced motionThe relief standing and still on the first paint. No arrival, no springs, no pointer; nothing lost.
How it works
Made of: Pressure field, Spring heightfield, Hex pin grid, Image heightmap, Silhouette inflate, Stroke aware pitch, Cast shadow march, Sprite atlas shading, Dirty region repaint, Sleeping loop, Text relief.
Read more: How the Pin Screen works.
Original. Taken from the physical pin-art toy, not from a catalogue reference, so references is honestly empty. Canvas 2D only; the relief is text in the page fonts, a procedural hand or mark drawn with canvas paths, or any image the page passes in, so no image ships.