https://github.com/teamwertarbyte/react-hero-animation
A small react library for hero animations.
https://github.com/teamwertarbyte/react-hero-animation
Last synced: 12 months ago
JSON representation
A small react library for hero animations.
- Host: GitHub
- URL: https://github.com/teamwertarbyte/react-hero-animation
- Owner: TeamWertarbyte
- License: mit
- Created: 2017-01-21T16:50:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-15T12:53:40.000Z (about 9 years ago)
- Last Synced: 2025-04-10T16:12:21.278Z (about 1 year ago)
- Language: JavaScript
- Size: 213 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-hero-animation
With this library, you can easily create Hero animations in your React apps. A demo is available [here][gh-pages].
## Usage
The `HeroAnimationProvider` needs to wrap all components. It tracks the registered heroes and which one to animate.
Also, every animatable element (the heroes) need to be wrapped with a `Hero` component.
```jsx
import { HeroAnimationProvider, Hero } from 'react-hero-animation'
```
## `Hero` properties
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| children* | `element` | | One child element, must be either a dom element or a `React.Component` instance (it gets a `ref`, so pure functional components are not supported). |
| id* | `string` | | A unique ID of this hero. Every hero with the same ID is treated as one animatable element and only one of it can be visible at once. |
| resize | `bool` | `false` | If true, the wrapped component will be resized (using `width` and `height`) instead of scaled. |
| show | `bool` | `false` | Displays the wrapped component, using a hero animation. Only one `Hero` can be displayed at a time. |
## License
The files included in this repository are licensed under the MIT license.
## Related projects
There is another project, [Pajn/react-hero-transition][react-hero-transition], that provides almost the same functionality (except for `resize`) and might be more flexible. It was published four days before this library, we just found it when we were about to publish this one.
[gh-pages]: https://teamwertarbyte.github.io/react-hero-animation/
[react-hero-transition]: https://github.com/Pajn/react-hero-transition