Basinfy/Basinfy-SaaS-Studio / .claude/skills/saas-frontend-taste
saas-frontend-taste
VerifiedDesign, refine, and verify SaaS screens with anti-slop copy and responsive layout checks.
assets/moments/counter-rolls/moment.js
View on GitHub/*
counter-rolls - the digits of one to four proof figures roll once, like an odometer, when the row
first comes on screen, and stop on the real figure (a price, a count, a time the brief gives; never an
invented outcome like "98% satisfied"). The figure is written in the HTML as its final
value (without script it stands); the script builds a strip for every digit that starts and ends on
that digit, so at rest (before the row enters, in a full-page shot, after the roll) the row reads as
written, never as zeros. The right-most column turns the most (one turn more per column).
<div class="grid" data-moment="counter-rolls">
<div class="span-3"><p class="t-stat">€12</p><p class="t-small muted">a month for unlimited invoices</p></div>
…
</div>
Every .t-stat or [data-count] inside the host rolls (or the host itself when it is one). Whole
numbers read best: tabular figures make a decimal point or a thousands comma as wide as a digit.
opts: duration ms (1400), sequence ms between figures (90).
Reduced motion, no script: the figures stand.
*/
export default function (root, opts, lib) {
const nums = root.matches('[data-count], .t-stat') ? [root] : [...root.querySelectorAll('[data-count], .t-stat')];
if (!nums.length || lib.reduced()) return {};
const dur = opts.duration || 1400, sequence = opts.sequence ?? 90;
const built = nums.map(el => {
const text = el.textContent.trim();
el.setAttribute('aria-label', text);
el.classList.add('mo-cr');
const frag = document.createDocumentFragment();
const cols = [];
for (const ch of text) {
if (/\d/.test(ch)) {
const target = +ch, turns = Math.min(4, 1 + cols.length); // whole turns: the strip stops on the digit
const col = document.createElement('span');
col.className = 'mo-cr__col';
col.setAttribute('aria-hidden', 'true');
const strip = document.createElement('span');
strip.className = 'mo-cr__strip';
// the strip starts on the final digit, runs `turns` times round and ends on it again
for (let d = 0; d <= turns * 10; d++) { const s = document.createElement('span'); s.textContent = String((target + d) % 10); strip.append(s); }
col.append(strip);
frag.append(col);
cols.push({ strip, turns });
} else {
const s = document.createElement('span');
s.className = 'mo-cr__ch';
s.setAttribute('aria-hidden', 'true');
s.textContent = ch;
frag.append(s);
}
}
el.textContent = '';
el.append(frag);
return { el, cols };
});
const anims = [];
const run = () => built.forEach(({ el, cols }, n) => {
el.classList.add('is-on');
cols.forEach(({ strip, turns }, c) => {
const a = strip.animate([{ transform: 'translateY(0)' }, { transform: `translateY(${-turns * 10}em)` }], { duration: dur + c * 140, delay: n * sequence, easing: 'cubic-bezier(.2, .8, .2, 1)', fill: 'forwards' });
// the last cell is the same digit as the first: cancelling at the end leaves the strip at rest, no change on screen
a.finished.then(() => { try { a.cancel(); } catch { /* gone */ } }, () => {});
anims.push(a);
});
});
const seen = lib.once(root, run, { threshold: 0.4 });
return { destroy() { seen.destroy(); anims.forEach(a => { try { a.cancel(); } catch { /* done */ } }); } };
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |