Socket
Socket
Sign inDemoInstall

@crossani/react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crossani/react

A silky smooth declarative animation library for ReactJS.


Version published
Maintainers
1
Created
Source

React CrossAni

Bringing the awesome CrossAni transition and animation framework to ReactJS.

Installation

Install @crossani/react and crossani:

  • npm i crossani @crossani/react
  • pnpm i crossani @crossani/react
  • yarn add crossani @crossani/react

That's it.

Usage

  1. In your component, import EASE from crossani and useCrossani from @crossani/react, like so:
import {EASE} from "crossani";
import useCrossani from "@crossani/react";
  1. Add a hook call, and connect to the dom:
export default () => {
	const [ref, triggerAni] = useCrossani();

	return <div ref={ref}>{/* ... */}</div>;
};
  1. Add some transitions (see the main CrossAni readme for a better explanation of the transition format):
export default () => {
	const [ref, triggerAni] = useCrossani({
		default: {
			state: {},
			reset: true,
			cutOff: true,
			ms: 500,
			easing: EASE.inOut,
		},
		alternate: {
			state: {"margin-top": "2rem"},
			ms: 250,
			easing: EASE.out,
		},
	});

	return <div ref={ref}>{/* ... */}</div>;
};
  1. Run your transitions!!!
export default () => {
	const [ref, triggerAni] = useCrossani({...});

	useEffect(() => triggerAni("alternate"), []);

	return <div ref={ref}>{/* ... */}</div>;
};

FAQs

Package last updated on 03 Nov 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc