firemotion
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

firemotion

React Hooks for CSS Motion

This is for Easy and simple CSS motion.
A build advanced UI using Hooks.

useFiremotion

This hook is used to process page transitions by appropriately merging three CSS classes in order.

Parameters

First argument(string): Base css style
Second argument(Array<string>): If you want to use exit only, set entry to undefined.
Third argument(number): Time to wait before exit (in seconds)

import useFiremotion from "firemotion";

function MyComponent() {
  const animate = useFiremotion(styles.base, [styles.entry, styles.exit], 0.3);

  return <div className={animate}>Motion content</div>;
}

Example css

.base {
  opacity: 1;
  transition: all 0.3s;
}
.entry {
  opacity: 0;
  transform: translateY(20px);
}
.exit {
  opacity: 0;
  transition: all 0.3s;
  transform: translateY(-20px);
}

Best Practices

- Assure your CSS transitions are smooth for the best user experience.
- Use short motion durations to keep your UI responsive.
- Test your motions on various devices to ensure performance.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i firemotion

    Weekly Downloads

    19

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    7.16 kB

    Total Files

    7

    Last publish

    Collaborators

    • s.watanabe