MCPcopy
hub / github.com/DavidHDev/react-bits / Number

Function Number

src/content/Components/Counter/Counter.jsx:6–21  ·  view source on GitHub ↗
({ mv, number, height })

Source from the content-addressed store, hash-verified

4import './Counter.css';
5
6function Number({ mv, number, height }) {
7 let y = useTransform(mv, latest => {
8 let placeValue = latest % 10;
9 let offset = (10 + number - placeValue) % 10;
10 let memo = offset * height;
11 if (offset > 5) {
12 memo -= 10 * height;
13 }
14 return memo;
15 });
16 return (
17 <motion.span className="counter-number" style={{ y }}>
18 {number}
19 </motion.span>
20 );
21}
22
23function normalizeNearInteger(num) {
24 const nearest = Math.round(num);

Callers 6

roundToStepFunction · 0.50
PreviewSliderFunction · 0.50
roundToStepFunction · 0.50
ShuffleDemoFunction · 0.50
ASCIITextDemoFunction · 0.50
createParserFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected