Skip to the page
TACTILE UI

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
On this page
  1. Use it
  2. Options
  3. Methods
  4. States
  5. How it works
  6. Blocks built with it
01

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

Options

OptionTypeDefaultWhat it does
texttext'TACTILE'The word behind the board. Empty is a plain board that takes the shape of whatever presses it.
shapetext · hand · mark'text'The word, an open hand or a round mark. In code, any image or canvas works too.
finishsteel · brass · ink · chalk'steel'Finish
framemachined · acrylic · none'machined'Frame
holdbooleantrueLike the toy, the shape stays up. Off: it appears only under the hand.
keepbooleanfalseWhat the hand presses stays until the board is shaken flat.
pointerlift · wipe'lift'Lift pushes pins out from behind; wipe presses them back flat from the front.
pitchnumber, 8 to 2412The largest pitch. Small boards go finer so the relief stays legible.
pinSizenumber, 0.4 to 0.950.85Head diameter as a share of the pitch.
radiusnumber, 40 to 240130Hand radius (px)
depthnumber, 0.2 to 10.7Relief depth
memorynumber, 0 to 10.45How long a stroke stays when the impression is not kept. 0 lets go at once; 1 holds for seconds.
lightnumber, 0 to 3453150 is from above, clockwise.
introbooleantrueThe relief comes up through the pins when the board first comes into view.
arrivalwave · press'wave'A wave that reads left to right, or deepest first, like a hand pushed in from behind.
03

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).
state
destroy()
Stops it and cleans up after it.
04

States

  1. 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.
  2. At restThe relief stands proud under the lamp (hold), the flush field sparkles; the loop is asleep and costs nothing.
  3. 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.
  4. RememberingWithout keep, pressure decays with a half-life set by memory, so a stroke lingers and lets go.
  5. Impression keptWith keep, whatever the hand pressed stays until reset(); the loop still sleeps once the pins settle.
  6. Shaken flatreset() drops every pin top to bottom in 0.3 s, then the relief presses back in.
  7. Off screen or hiddenThe loop pauses; a returning tab cannot launch the springs with a long frame.
  8. ResizedRebuilt at the new size, pitch refitted so the relief stays legible; a relief that had arrived is simply there.
  9. PhoneSmall boards get finer pins so the word stays at least ten pins tall; pan-y keeps vertical scrolling.
  10. Reduced motionThe relief standing and still on the first paint. No arrival, no springs, no pointer; nothing lost.
05

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.

06

Blocks built with it

Docs
Finish
Volume