timered-counter
Version:
Make the value change more vivid and natural
25 lines • 1.8 kB
JavaScript
import { equal as _equal, sleep } from '../utils/index.js';
export async function bigNumber(context, { counter, setBy, equal = _equal, }) {
const { step, args } = context;
const list = [
'0',
'179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
'359538626972463140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
'539307940458694710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
];
await step('Incrementing the value', async () => {
for await (const value of list) {
setBy(counter, 'value', value);
await sleep((args.animationOptions.duration ?? 100) + 10);
await equal(counter, counter.value, value);
}
});
await step('Decrementing the value', async () => {
for await (const value of list.reverse()) {
setBy(counter, 'value', value);
await sleep((args.animationOptions.duration ?? 100) + 10);
await equal(counter, counter.value, value);
}
});
}
//# sourceMappingURL=big-number.js.map