MINT / ENGRAVED COIN RECORD

Read the two-sided coin record before you flip

This engraved ledger maps the current Coin Flip editor: five selectable design IDs, visible button and drag controls, the result expression, motion constants, displayed record, stored values, sound, and confetti paths.

Open Coin Flip

Motif selector / five engraved IDs

The selector contains exactly five IDs: euro, dollar, chf, gbp, and gold. The editor resolves the names and side labels from its design objects and localized name mapping.

  • euro
  • dollar
  • chf
  • gbp
  • gold

The five IDs identify selectable designs in this interface; this record does not assign a further attribute to them.

Activation rail / button, drag, key

Use the visible button or drag control. The button calls flipCoin(1.5). isFlipping prevents another flip path while one is in progress.

01 · BUTTON — Visible flip control

Pressing the visible control calls flipCoin(1.5). The control is disabled while isFlipping is true.

02 · DRAG — Upward offset and release

offset = max(dragStartY - clientY, 0), capped at 100px. Drag end starts only when offset > 30 or velocity > 2, using max(offset / 30, velocity / 3).

03 · KEY — Enter or Space guard

Enter or Space calls flipCoin(1.5) only when the event target is not input, textarea, button, select, or [contenteditable=true].

Motion plate / outcome and rotation

The editor derives its shown side with Math.random() > 0.5 ? heads : tails, then uses requestAnimationFrame for the motion updates.

RESULT — Shown side expression

Math.random() > 0.5 ? heads : tails. The end rotation is heads = 0 and tails = 180.

TURNS — Turn components

For flipCoin(velocity=1), baseFlips=4 and extraFlips=min(velocity*2,6). total rotation=(baseFlips+extraFlips)*360+end rotation.

TIME — Motion duration

duration=1500+velocity*500 ms. requestAnimationFrame updates rotation, arc, scale, and shadow during the path.

Flip record / visible history boundary

After the motion ends, showResult, confetti state, and the FlipResult result/timestamp/coinType are set; the result is inserted at the front, total increases by 1, and an analytics event is sent.

HISTORY — Front insert, retain 20

The editor prepends the FlipResult and keeps at most 20 history entries.

SIDE VIEW — Display 10 entries

The side view uses history.slice(0,10). When history is nonempty, it shows rounded heads and tails percentages from the current history.

READOUT — Displayed record only

The counts and percentage readout describe the displayed history; this page does not treat them as a statistical or probability assessment.

Stored-value ledger / load and clear path

On mount, the editor reads coinFlipHistory, coinFlipTotalFlips, coinFlipSound, and coinFlipSelectedCoin. Its effect writes history, including an empty array, total, sound, and the selected coin ID.

LOAD — Accepted values

History accepts only objects whose result is heads or tails and slices to 20. Total is accepted only when finite and >= 0; selectedCoin must be a known design ID.

PARSE — Invalid JSON path

If JSON parsing fails, coinFlipHistory and coinFlipTotalFlips are removed. Sound and selected coin are then resolved from their stored strings when present.

CLEAR — Reset record and total

Clear history sets history to [] and totalFlips to 0; the effect then writes those new values under the named keys.

Scope notes

  • AudioContext is attempted during a flip; a supported suspended context is resumed, and the visible sound control toggles the setting.
  • After the end path, the confetti state starts a canvas loop with 150 particles and its effect cleans up the animation frame loop.
  • This record describes editor branches and visible controls, not an assessment of an outcome or display.
  • Use the visible button and drag control to interact with the editor.

Continue with adjacent tools

Each linked tool has its own controls and state path.

Questions about the coin record

Which motifs can be selected?

The selector has the IDs euro, dollar, chf, gbp, and gold. The editor resolves visible names and side labels from its existing design and localized mapping.

How can a flip start?

The visible button calls flipCoin(1.5). A drag uses offset = max(dragStartY - clientY, 0), capped at 100px, and releases only when offset > 30 or velocity > 2. Enter or Space follows its target guard and calls flipCoin(1.5).

What expression and motion values are used?

The side expression is Math.random() > 0.5 ? heads : tails. baseFlips=4, extraFlips=min(velocity*2,6), duration=1500+velocity*500 ms, and total rotation=(baseFlips+extraFlips)*360+end rotation.

What does the side view show?

History retains 20 entries, the side view uses history.slice(0,10), and nonempty history shows rounded heads and tails percentages for that display.

Which stored values are read and written?

The named values are coinFlipHistory, coinFlipTotalFlips, coinFlipSound, and coinFlipSelectedCoin. Invalid JSON removes history and total; clearing sets history to [] and total to 0 before the effect writes them.

What do sound and confetti paths do?

A flip attempts AudioContext and resumes a supported suspended context. At the end, confetti state runs a 150-particle canvas loop that cleans up its animation frame loop.

Open the coin controls

Choose a visible motif, then use the button or drag control and read the displayed record.

Open Coin Flip