npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fecapark/number-rolling

v0.0.7

Published

The React library for number rolling animation.

Downloads

12

Readme

Number Rolling

The React library for number rolling animation.

화면 기록 2024-05-18 22 56 51

Install

npm i @fecapark/number-rolling
yarn add @fecapark/number-rolling

Usage

All Properties

import { Roller } from "@fecapark/number-rolling";

<Roller
  value={13000}
  suffix="",
  suffixPosition="back",
  align="center",
  fontSize={48},
  rollDuration={0.6},
  shiftDuration={0.45},
  staggering={false},
  diff={false},
  rollWay="down",
  showAfterFontNameLoaded="",
/>;

| prop | description | type | initial value | required | | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | --------------------------- | -------- | | value | Number(integer, float) value to display. | number | value required | true | | suffix | Suffix string to display. | string | "" (empty string) | false | | suffixPosition | Determines position of the suffix string. | front or back | back | false | | align | Text align of animation container width change. | left or center or right | center | false | | fontSize | Font size of value and suffix. | number | 48 | false | | rollDuration | Duration of value rolling animation. | number (seconds) | 0.6 (seconds) | false | | shiftDuration | Duration of width changing animation. | number (seconds) | 0.45 (seconds) | false | | staggering | Determines trigger each value's rolling animation as sequence or randomly. | boolean | false (triggers randomly) | false | | diff | Determines trigger rolling aniamtion for only changed values. | boolean | false | false | | rollWay | Rolling animation's roll direction. | up or down | down | false | | showAfterFontNameLoaded | This component will be show after setted font-face loaded. If you setted font-family through any styling to this component, you should set this prop values as your font-family values for preventing CLS(Cumulative Layout Shift). See examples. | string[] | [] (empty array) | false |

Examples

Simple usage

import { Roller } from "@fecapark/number-rolling";

<Roller value={13000} />;

화면 기록 2024-05-18 23 28 00

With suffix

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} suffix="%" />;

화면 기록 2024-05-18 23 30 50

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} suffix="$" suffixPosition="front" />;

화면 기록 2024-05-18 23 31 24

Align

For use align props,
Roller component should be wrapped in an element that has enough width.

import { Roller } from "@fecapark/number-rolling";

<div style={{ width: 600 }}>
  <Roller value={...} align="right" />;
</div>

화면 기록 2024-05-18 23 34 26

import { Roller } from "@fecapark/number-rolling";

<div style={{ width: 600 }}>
  <Roller value={...} align="left" />;
</div>

화면 기록 2024-05-18 23 36 57

Staggering

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} staggering={true} />;

화면 기록 2024-05-18 23 39 34

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} staggering={false} />;

화면 기록 2024-05-18 23 40 03

Diff

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} diff={true} />;

화면 기록 2024-05-18 23 44 10

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} diff={false} />;

무제

Rollway

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} rollWay="up" />;

화면 기록 2024-05-18 23 53 52

import { Roller } from "@fecapark/number-rolling";

<Roller value={...} rollWay="down" />;

화면 기록 2024-05-18 23 54 38

showAfterFontNameLoaded

If you setted font-family, recommended to use this property.

In example below, the font Roboto and Noto Sans are setted. After all setted fonts are loaded, if any one of the fonts is successfully loaded, the components are displayed on the screen.

import { Roller } from "@fecapark/number-rolling";

<div style={{
  fontFamily: "Roboto, 'Noto Sans' sans-serif"
}}>
  <Roller value={...}  showAfterFontNameLoaded={["Roboto", "Noto Sans"]} />;
</div>

| Roboto Loaded | Noto Sans Loaded | Result | | ------------- | ---------------- | -------- | | loaded | loaded | show | | failed | failed | not show | | loaded | failed | show | | failed | loaded | show |