Show plan
A show plan is a tier's reveal written down as data: how the card waits face down, which effects fire, how long each part takes. A renderer follows the plan instead of asking whether a card is epic, which is why three tiers or seven get the right show with no extra code.
showFor
import { showFor } from "@react-cards-opening/core";
showFor("legendary");
// {
// jolt: true, the place it was found flashes and shakes
// hum: { kind: "shake", seconds: 0.7 }, what the face-down card does
// rays: true, a wheel of rays opens behind it
// legendary: true, flash, shockwaves, foil, shine, sparkles
// flightSeconds: 0.75,
// flipSeconds: 0.6,
// minHoldSeconds: 2.65,
// }| Effect | jolt | hum | rays | legendary | minHoldSeconds |
|---|---|---|---|---|---|
quiet | no | hop, 0.4 s | no | no | 1.75 |
loud | yes | shake, 0.4 s | yes | no | 1.75 |
legendary | yes | shake, 0.7 s | yes | yes | 2.65 |
The second argument is reduced motion. With it, the hum is gone, the flight and the flip are instant, the legendary show is off and the shortest hold is one second.
How long a card stays up
import { holdSeconds, showFor } from "@react-cards-opening/core";
const texts = [card.name, "Legendary", card.line, "Found on Mar 14"];
holdSeconds(texts, showFor("legendary")); // seconds face upA card stays face up for as long as its own text takes to read, and never less than its show takes to play out. Reading is counted at four words a second after a 0.8 second lead. A sentence counts in full; a word standing alone, like a tier's name, is taken in at a glance and counts for little.
| Function | Returns |
|---|---|
wordsToRead(texts) | How much there is to read, in words. |
readingSeconds(texts) | The seconds that takes. |
holdSeconds(texts, plan) | The longer of that and the plan's minHoldSeconds. |