1.1.6 • Published 2 years ago

use-bouncy-text v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

use-bouncy-text

A React hook to make any text node bOuNcY

example

Installation

npm install use-bouncy-text

Usage

/* Define your bounce styles */
@keyframes bounce {
  60% {
    transform: translate(0px, -2px) scale(1.2);
  }
}

.bouncy-text {
  display: inline-block;
  margin: 0 1px;
  animation: bounce 0.6s infinite ease-in-out;
}
import { useBouncyText } from 'use-bouncy-text';

export function ComponentWithBouncyText() {
  // Define a ref to the text node you want to make bouncy
  const bounceRef = useRef();
  // pass the ref and your CSS class to the hook
  useBouncyText(bounceRef, 'bouncy-text');

  return <div ref={bounceRef}>I'm bouncy teeeeext</div>;
}
1.1.6

2 years ago

1.1.4

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago