用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill ngx-digit-flow命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | ngx-digit-flow |
| description | > Use when this capability is needed. |
ngx-digit-flow is a standalone Angular component for polished digit-by-digit number animation.
It is zero-dependency, SSR-safe, signal-friendly, locale-aware, and built on the Web Animations API,
CSS @property, and CSS math.
Use it when a user wants polished animated numbers in Angular.
npm install ngx-digit-flow
import { Component, signal } from '@angular/core';
import { DigitFlowComponent } from 'ngx-digit-flow';
@Component({
selector: 'app-price',
imports: [DigitFlowComponent],
template: `
<ngx-digit-flow [value]="price()" [format]="{ style: 'currency', currency: 'USD' }" />
`,
})
export class PriceComponent {
price = signal(182.5);
}
| Input | Type | Default | Guidance |
|---|---|---|---|
value | number | required | The number to display and animate. |
format | Intl.NumberFormatOptions | {} | Forwarded to Intl.NumberFormat; use for currency, percent, compact notation, grouping, fraction digits. |
locales | string | string[] | undefined | Locale and numbering system support, including non-Latin digit glyphs. |
prefix | string | '' | Custom text before the formatted number. Prefer format for real currency/sign/unit formatting. |
suffix | string | '' | Custom text after the formatted number. Prefer format for percent/unit when possible. |
animated | boolean | true | Set false to disable all animation. |
duration | number | 900 | Shared spin + layout duration in milliseconds. |
opacityDuration | number | 450 | Presence fade duration for entering/exiting digits, separators, and literals. |
spinEasing | DigitFlowEasing | spring | Named preset (spring, default, overshoot) or any CSS easing string. Use the default unless the user asks for a different feel. |
flipEasing | DigitFlowEasing | spring | Same presets/raw CSS support for horizontal layout motion. |
transformTiming | DigitFlowTiming |
| Output | Payload | Guidance |
|---|---|---|
animationsStart | void | Fires once when an animation batch starts. Interrupted batches do not emit duplicate starts. |
animationsFinish | void | Fires once when all in-flight batches settle, including interrupted/out-of-order batches. |
Prefer the standard component before reaching for timing overrides. The default spring is the recommended baseline:
<ngx-digit-flow [value]="n" />
Only use spinEasing="overshoot" or flipEasing="overshoot" when the user explicitly asks for a snappier, bouncier, or more playful feel. Do not recommend overshoot by default.
For currency and product metrics:
<ngx-digit-flow
[value]="revenue()"
[format]="{ style: 'currency', currency: 'USD' }"
[continuous]="true"
/>
For compact dashboards:
<ngx-digit-flow [value]="views()" [format]="{ notation: 'compact', maximumFractionDigits: 1 }" />
For countdown or clock-like reels:
<ngx-digit-flow [value]="seconds()" [digits]="{ 1: { max: 5 } }" [trend]="-1" />
The implementation uses a reel-based WAAPI animation model:
121, 122, ... as intermediate Angular states. It creates the illusion by spinning lower unchanged digits one full reel.--_df-d, --_df-d-opacity, --_df-d-width, and --_df-dx are animated as typed CSS properties.composite: 'accumulate'. Rapid changes stack without snapping because WAAPI animations accumulate deltas.mod() reel math. Each digit computes its circular position from current + delta, so reels wrap smoothly.linear(...); opacity defaults to 450ms ease-out.stagger delays newly entering/exiting digits and separators. Do not stagger core spin or layout because it desynchronizes the number.@property, CSS mod(), and WAAPI linear(...) easing support. Otherwise the component still renders the final value.When adding ngx-digit-flow to an Angular component:
DigitFlowComponent in the standalone component imports.<ngx-digit-flow [value]="..." />.format/locales over hand-built prefixes/suffixes for currency, percent, units, compact notation, and localized digits.continuous for counters where higher-place changes should feel like they tick through values.spinEasing="overshoot" or flipEasing="overshoot".stagger only to reveal entering/exiting parts; do not expect it to affect same-width number updates.aria-hidden wrappers.Numbers render but do not animate
mod(), CSS @property, WAAPI, or WAAPI linear(...).animated may be false.prefers-reduced-motion may be active while respectMotionPreference is true.stagger looks like nothing happens
stagger only affects entering/exiting parts such as new digits, removed digits, group separators, literals, or decimals.Continuous looks different from a JS counter
Custom digit ranges show wrong values
digits is keyed by decimal position from the right: i0/position 0 is ones, 1 is tens, 2 is hundreds.Need to coordinate multiple values
DigitFlowGroupDirective and wrap related instances:<div ngxDigitFlowGroup>
<ngx-digit-flow [value]="hours()" />
<span>:</span>
<ngx-digit-flow [value]="minutes()" [digits]="{ 1: { max: 5 } }" />
</div>
Source: ayangabryl/ngx-digit-flow — distributed by TomeVault.
duration + flipEasing |
Full WAAPI timing for layout/FLIP and container width motion. Overrides duration/flipEasing. |
spinTiming | DigitFlowTiming | transformTiming | Full WAAPI timing for vertical digit reel motion. Overrides duration/spinEasing. |
opacityTiming | DigitFlowTiming | opacityDuration | Full WAAPI timing for presence fades. |
trend | number | (oldValue, value) => number | auto | Controls digit path. Use 1 to count up, -1 to count down, 0 per-digit local direction, or a function. |
continuous | boolean | false | Visual continuity mode: lower unchanged digits loop one full reel when a higher-place digit changes. |
digits | Record<number, { max?: number }> | {} | Custom reel ranges by decimal position, e.g. { 1: { max: 5 } } for clock tens. |
respectMotionPreference | boolean | true | Skips animations when prefers-reduced-motion: reduce is active. |
stagger | number | 0 | Delay in ms between entering/exiting presence animations only. Core spin and layout remain synchronized. |
colorOnIncrease | string | undefined | Flash color when value increases. |
colorOnDecrease | string | undefined | Flash color when value decreases. |