๐Ÿš€ DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

@flipify/core

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flipify/core

Flipify is a Type-Safe, Customizable, Concise, and Intuitive Declarative Flip Animation Library.

npmnpm
Version
0.0.3
Version published
Maintainers
0
Created
Source

Flipify

Flipify๋Š” ์„ ์–ธ์ ์ธ Flip ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์œ„ํ•œ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค.

Features

  • ์„ ์–ธ์ ์ธ Trigger ๊ธฐ๋ฐ˜ ์• ๋‹ˆ๋ฉ”์ด์…˜

    Flipify๋Š” Flip ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์„ ์–ธ์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•ด ๊ฐ„๊ฒฐํ•˜๊ณ  ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๋Š” Trigger ํ•จ์ˆ˜ ํ•˜๋‚˜๋กœ, ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • TypeScript ๊ธฐ๋ฐ˜์˜ ๊ฐ•๋ ฅํ•œ ํƒ€์ž… ์•ˆ์ •์„ฑ

    Flipify๋Š” ์ƒ์„ธํ•˜๊ณ  ์ง๊ด€์ ์ธ ํƒ€์ž… ์ •์˜๋ฅผ ์ œ๊ณตํ•˜์—ฌ ์•ˆ์ •์ ์ด๊ณ  ์˜ˆ์ธก ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ์œ ์—ฐํ•œ ์Šคํƒ€์ผ ์ปค์Šคํ„ฐ๋งˆ์ด์ง•

    Flipify๋Š” ๋‹ค์–‘ํ•œ ์š”๊ตฌ์‚ฌํ•ญ์— ๋งž์ถฐ ์„ธ๋ถ€์ ์ธ ์Šคํƒ€์ผ ์†์„ฑ์„ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌผ๋ก , ๊ธฐ๋ณธ๊ฐ’์„ ํ™œ์šฉํ•ด ๊ฐ„ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋ฐ˜์‘ํ˜• ๋””์ž์ธ ์ง€์›

    Flipify๋Š” ๋‹ค์–‘ํ•œ ํ™”๋ฉด ํฌ๊ธฐ์—์„œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

Installation

npm install @flipify/core
pnpm add @flipify/core
yarn add @flipify/core

Usages

JavaScript

<div id="flip-container"></div>
import { initialize } from '@flipify/core';

const container = document.getElementById('flip-container');

const { trigger } = initialize(container, 0, { useDigit: true });

let currentNumber = 0;

setInterval(() => {
  currentNumber = currentNumber + 1;
  trigger(currentNumber);
}, 1000);

React

import { initialize } from '@flipify/core';
import React, { useEffect, useRef, useState } from 'react';

export const Flip: React.FC = () => {
  const containerRef = useRef<HTMLDivElement>(null);
  const triggerRef = useRef<((value: number) => void) | null>(null);
  const [currentNumber, setCurrentNumber] = useState(0);

  useEffect(() => {
    const container = containerRef.current;

    if (!container) return;

    const { trigger } = initialize(container, currentNumber, { useDigit: true });

    triggerRef.current = trigger;
  }, []);

  useEffect(() => {
    const interval = setInterval(() => {
      setCurrentNumber((prev) => prev + 1);

      if (triggerRef.current) {
        triggerRef.current(currentNumber);
      }
    }, 1000);

    return () => clearInterval(interval);
  }, [currentNumber]);

  return <div ref={containerRef} style={{ height: '50vh' }} />;
};

Options

์˜ต์…˜ํƒ€์ž…์„ค๋ช…๊ธฐ๋ณธ๊ฐ’๋น„๊ณ 
useDigitboolean์ž๋ฆฟ์ˆ˜ ๋ณ€๊ฒฝ ์—ฌ๋ถ€falsetrue, false
animation.durationTDuration์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์ง€์† ์‹œ๊ฐ„500ms ๋‹จ์œ„, ์˜ˆ: 1000, 500
style.card.widthTDimension์นด๋“œ์˜ ๋„ˆ๋น„300pxnumber๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ, ์˜ˆ: 100px, 20%, 10rem, 100
style.card.heightTDimension์นด๋“œ์˜ ๋†’์ด400pxnumber๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ, ์˜ˆ: 200px, 20%, 10rem, 200
style.card.fontSizeTDimension์นด๋“œ์˜ ํฐํŠธ ํฌ๊ธฐ200pxnumber๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ , ์˜ˆ: 20px, 3rem, 18
style.card.borderRadiusTDimension์นด๋“œ์˜ ํ…Œ๋‘๋ฆฌ ๋ฐ˜๊ฒฝ10pxnumber๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ , ์˜ˆ: 10px, 50%, 5
style.centerLine.heightTDimension์ค‘์•™์„ ์˜ ๋†’์ด10pxnumber๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ , ์˜ˆ: 2px, 1rem, 5
style.centerLine.backgroundColorTColor์ค‘์•™์„ ์˜ ๋ฐฐ๊ฒฝ์ƒ‰#DDDDDD50์˜ˆ: #000000, rgba(0, 0, 0, 0.2)
style.number.colorTColor์ˆซ์ž์˜ ์ƒ‰์ƒ#FFFFFF์˜ˆ: white, #ff5722, rgb(0, 0, 0)
style.number.backgroundColorTColor์ˆซ์ž์˜ ๋ฐฐ๊ฒฝ์ƒ‰#000000์˜ˆ: black, #eeeeee, rgb(255, 255, 255)

Licenses

MIT License

Copyright (c) 2024 HyoungMin

Keywords

Flip

FAQs

Package last updated on 21 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts