# react-flying-item

> NPM Library to make the selected item image seem to fly to top left corner (e.g: fly to cart icon)

Latest version **1.1.3** (published 2023-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-flying-item
pnpm add react-flying-item
yarn add react-flying-item
bun add react-flying-item
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2023-12-05 |
| First published | 2022-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Ahmed-Elswerky |
| Maintainers | ahmed-elswerky |
| Keywords | react, button, e-commerce, react-component, flying, popup, cart, checkout |

## Links

- npm: https://www.npmjs.com/package/react-flying-item
- Repository: https://github.com/Ahmed-Elswerky/react-flying-item
- Homepage: https://github.com/Ahmed-Elswerky/react-flying-item#readme
- Issues: https://github.com/Ahmed-Elswerky/react-flying-item/issues
- npm.io page: https://npm.io/package/react-flying-item

## 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

- 1.1.3 (latest) — 2023-12-05
- 1.1.4 — 2023-12-04
- 1.1.2 — 2022-09-28
- 1.1.1 — 2022-09-28
- 1.0.9 — 2022-09-26
- 1.0.7 — 2022-09-26
- 1.0.6 — 2022-09-26
- 1.0.5 — 2022-09-26
- 1.0.4 — 2022-09-26
- 1.0.3 — 2022-09-25
- 1.0.1 — 2022-09-25
- 1.0.0 — 2022-09-25

## README

# react-flying-item

> Npm Library to make the selected item image seem to fly to top left corner (e.g: fly to cart icon)

[![NPM](https://img.shields.io/npm/v/react-flying-item.svg)](https://www.npmjs.com/package/react-flying-item)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) 
[![Bundle Size](https://img.shields.io/bundlephobia/minzip/react-flying-item?label=Bundle%20size)](https://bundlephobia.com/result?p=react-flying-item) 
[![Downloads](https://img.shields.io/npm/dm/react-flying-item?label=Downloads)](https://www.npmtrends.com/react-flying-item) 
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)


> [Demo CodePen](https://codepen.io/Ahmed_Elswerky/pen/YzLEQGj)

![Example Gif](./ex.gif)

## Install

```bash
npm install --save react-flying-item
```

## Customizable values props

| Field Name        | Type     | Required/Optional | Default value                           | Details
| ----------------- | -------- | ----------------- | --------------------------------------- | -----------------
| targetTop         | `String` | Optional          | '5%'                                    | By default, animation ends in the top 5% 
| targetLeft        | `String` | Optional          | '5%'                                    | By default, animation ends in the left 5% 
| customAnimation   | `String` | Optional          | ''     (e.g: 20%{translate:80% 80%;})   | customizing the animation from 1% to 99%
| animationDuration | `Int`    | Optional          | 0.9                                     | By default, animations takes 0.9s to finish
| flyingItemStyling | `Object` | Optional          | { borderRadius: '4rem', width: '8rem' } | Custom style the flying item 

## Main Behavior Points

- Animation period is 900 ms
- Animation ends with Opacity 0
- Position is Fixed and values of top and left are reset from [event mouse clientX,clientY] to 5%,5%

## Usage

```jsx
import React from 'react'
import FlyingButton from 'react-flying-item'

const App = () => {
  return (
    <div>
      <img src='[src-url]]' alt='' />
      <FlyingButton src='[src-url]'>fly</FlyingButton>
    </div>
  )
}

export default App
```

## License

MIT © [Ahmed-Elswerky](https://github.com/Ahmed-Elswerky)

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