# resap

> React hooks for easy GSAP animations, cause why not?

Latest version **0.2.2** (published 2020-07-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install resap
pnpm add resap
yarn add resap
bun add resap
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2020-07-06 |
| First published | 2020-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Sepp Wikramaratna-Clarke |
| Maintainers | phl3bas |
| Keywords | npm, node, react, javascript, gsap, animation, animations, hooks, library |

## Links

- npm: https://www.npmjs.com/package/resap
- Repository: https://github.com/Phl3bas/Resap
- Homepage: https://github.com/Phl3bas/Resap#readme
- Issues: https://github.com/Phl3bas/Resap/issues
- npm.io page: https://npm.io/package/resap

## Dependencies (1)

- [gsap](https://npm.io/package/gsap.md) ^3.3.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2020-07-06
- 0.2.1 — 2020-07-06
- 0.2.0 — 2020-07-06
- 0.1.0 — 2020-07-01

## README

# Resap
React hooks for easy GSAP animations, cause why not?

```javascript
npm install resap
```

+ useToggle (toggles GSAP animation from base css styling to stated animation based on state changes)

```javascript 
//import useToggle from resap library

import { useToggle } from 'resap'

// create your state!
 const [open, set] = React.useState(true);

// create a handler to change your state
 const handleClick = () => {
    set(!open);
  };


// set your gsap animation props! (use useRef or useMemo so the object doesn't get recreated on each render!)
 const { current: animProps } = React.useRef({
    opacity: 0,
    y: 30,
    duration: 0.2,
    ease: 'power3.out',
  });

// call the useToggle hook which returns a ref, passing in your state and the animation props!
  const ref = useToggle(open, animProps);

// pass your ref to the object you wish to animate! when your state changes the toggle animation will trigger!
return (
   <div ref={ref} onClick={handleClick} />
)
```

(More hooks to be included!)

---
_Source: https://npm.io/package/resap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
