A photo you can shred and pull back out

Drag the photo down into the shredder, or use the slider under it. While any of the photo is still showing, pull it back up and it comes out whole. Let go with all of it inside and it's deleted. The heart on the photo can be pressed as long as it's above the slot.

After Photo Shredder by Gabriel Obholz (on Memorables).

harbour-dawn.jpg2 Nov 2026, 06:48

 

Show the code the markup, the copy, the paint, the drag and the slider, the strips
  1. The markup. A <figure> with a button in it, the shredder as one element, and a range outside the canvas.
  2. Styles. The photo has touch-action: none, so a drag on it moves the photo and not the page.
  3. The copy. Draw the photo once, whole, and copy that rectangle of the canvas into a plain canvas.
  4. The paint. The part above the slot is the live element under a clip. The strips come from the copy. The shredder is drawn again with no alpha so it takes the taps below the slot.
  5. The drag and the slider. Both set the same number. Letting go at 100 deletes the photo.
  6. The strips. Each strip is pieces of the copy, pushed sideways a little more the further down they are.

How it works

The photo is a <figure> with a picture made of CSS gradients, a caption and a favourite button. It's a child of the canvas. The shredder and its bin are one more element in the canvas, and the range is an ordinary <input type="range"> under it.

One number. How far the photo has gone in is the range's value, from 0 to 100. Dragging the photo sets the range, and the range moves the photo, so the arrow keys on the range do what a drag does. Letting go of either at 100 deletes the photo.

Above the slot. The part of the photo that hasn't gone in is drawn with drawElementImage() under a clip that ends at the slot. It's the real element, moved down, so its button can be pressed. A clip doesn't shrink the element's hit box, so the shredder is drawn again after it with no alpha. Where two hit boxes overlap the element drawn last takes the tap, and below the slot that's the shredder.

Below the slot. When the photo starts going in, and again whenever its button changes, the canvas draws the whole photo once, copies that rectangle of itself into a plain canvas with drawImage(), and clears. The strips under the shredder are drawn from that copy: 16 strips, each cut into pieces 12 pixels tall that sway further out the further they hang. The row at the top of each strip is the row of the photo that's inside the shredder now, so pulling the photo up pulls the strips back in.

Deleted. At 100 the strips are let go and fall into the bin. The photo is made inert, so its button can't be reached, and "Put the photo back" brings it back.

Live checks

These run on their own small canvases in the corner of the window.

Findings