Pixel UI/Physics & time/Rewind

Rewind

A VCR for any part of your page. Everything that changes in it can be rewound.

<piix-rewind>DOM + canvas

Edit anything, then rewind.

Type here, delete things, then press ◀◀ below.

It records every change inside it as it happens: text typed into fields and editable areas, elements your code adds and removes, attributes, checkboxes and selects. Press ◀◀ and it rewinds like a tape, with scanlines, a rolling tracking band and the time counting back, every change undone in reverse, letter by letter. Drag the playhead to any moment, ►► to come back to now, or KEEP to carry on from that moment (everything after it is dropped, like undo). These are the real changes reversed, not screenshots: the past you see is live DOM, held still until you come back.

Installation

<!-- once, anywhere on the page: every component -->
<script src="https://cdn.jsdelivr.net/npm/piixpal@0.6/piixpal.min.js"></script>

Usage

<piix-rewind>
  <div>
    <h3 class="ex-h3">Edit anything, then rewind.</h3>
    <p contenteditable style="padding:10px;outline:2px solid currentColor">Type here, delete things, then press ◀◀ below.</p>
    <label><input type="checkbox"> Remember me</label>
    <input type="text" placeholder="Your name">
  </div>
</piix-rewind>

Examples

Undo for a whole app

It records what your own code does too: here, tasks added, ticked and deleted.

    From your own code

    Hide the tape deck and build your own controls with rewind(), seek(), play() and keep().

    Write something…

    Rewind Back to now Keep

    API reference

    AttributeWhat it doesDefault
    maxhow many changes to remember2000
    speedhow fast it rewinds, 0.5 to 41
    controlsoff: no tape deck, drive it from code–
    soundmake sounds even without <piix-chiptune>; off keeps it silent–

    Events

    EventWhen
    seekit moved through time: detail.at, detail.steps
    keepyou carried on from the past

    Methods

    MethodWhat it does
    rewind()rewind, faster the longer it runs
    play()come back to now, replaying every change
    seek(step)jump to a step, 0 is the start
    keep()carry on from here: everything after is dropped
    clear()forget the history
    steps, athow many changes are recorded, and which one you are on

    Accessibility