{"id":14961341,"url":"https://github.com/randilt/react-animate-onview","last_synced_at":"2025-10-24T20:31:42.059Z","repository":{"id":252504258,"uuid":"840621728","full_name":"randilt/react-animate-onview","owner":"randilt","description":"A lightweight React component for adding smooth, customizable animations to elements as they enter the viewport.","archived":false,"fork":false,"pushed_at":"2024-08-11T04:59:58.000Z","size":51,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T04:23:46.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/randilt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-10T07:18:30.000Z","updated_at":"2024-09-02T01:13:03.000Z","dependencies_parsed_at":"2024-09-22T12:30:42.804Z","dependency_job_id":null,"html_url":"https://github.com/randilt/react-animate-onview","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"8e578a9ea683edf345d40ceff47760364c3c7644"},"previous_names":["randilt/react-animate-onview"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randilt%2Freact-animate-onview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randilt%2Freact-animate-onview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randilt%2Freact-animate-onview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randilt%2Freact-animate-onview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randilt","download_url":"https://codeload.github.com/randilt/react-animate-onview/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238035385,"owners_count":19405682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:24:51.004Z","updated_at":"2025-10-24T20:31:36.704Z","avatar_url":"https://github.com/randilt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Animate OnView\n\n[![npm version](https://badge.fury.io/js/react-animate-onview.svg)](https://badge.fury.io/js/react-animate-onview)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA lightweight React component for adding smooth, customizable animations to elements as they enter the viewport. Built with Framer Motion, this package makes it easy to create engaging scroll-based animations in your React applications.\n\n## Features\n\n- Easy to use React component\n- Customizable animation types (fade, slide, zoom, rotate)\n- Configurable animation duration and delay\n- Viewport detection for triggering animations\n- Staggered animations for multiple elements\n- TypeScript support\n\n## Installation\n\n```bash\nnpm install react-animate-onview framer-motion\n```\n\nor\n\n```bash\nyarn add react-animate-onview framer-motion\n```\n\n## Usage\n\nHere's a basic example of how to use the `AnimateOnView` component:\n\n```jsx\nimport React from \"react\";\nimport { AnimateOnView } from \"react-animate-onview\";\n\nconst MyComponent = () =\u003e {\n  return (\n    \u003cAnimateOnView animation=\"fadeInFromBottom\" duration={0.5} delay={0.2}\u003e\n      \u003ch1\u003eThis will animate when it enters the viewport\u003c/h1\u003e\n    \u003c/AnimateOnView\u003e\n  );\n};\n\nexport default MyComponent;\n```\n\n## API\n\nThe `AnimateOnView` component accepts the following props:\n\n- `animation` (required): The type of animation to apply. Options include:\n  - `\"fadeInFromBottom\"`\n  - `\"fadeInFromLeft\"`\n  - `\"fadeInFromRight\"`\n  - `\"zoomIn\"`\n  - `\"rotateIn\"`\n- `duration` (optional): The duration of the animation in seconds. Default is 0.5.\n- `delay` (optional): The delay before the animation starts in seconds. Default is 0.\n- `staggerDelay` (optional): The delay between each child element's animation when using staggered animations. Default is 0.1.\n- `viewportOnce` (optional): If true, the animation only happens once when the element comes into view. Default is false.\n- `viewportAmount` (optional): The amount of the element that needs to be in view before the animation triggers. Default is 0.1.\n\n## Examples\n\n### Fade in from bottom\n\n```jsx\n\u003cAnimateOnView animation=\"fadeInFromBottom\"\u003e\n  \u003cp\u003eThis paragraph will fade in from the bottom\u003c/p\u003e\n\u003c/AnimateOnView\u003e\n```\n\n### Zoom in with delay\n\n```jsx\n\u003cAnimateOnView animation=\"zoomIn\" duration={0.7} delay={0.3}\u003e\n  \u003cimg src=\"example.jpg\" alt=\"Example\" /\u003e\n\u003c/AnimateOnView\u003e\n```\n\n### Rotate in once\n\n```jsx\n\u003cAnimateOnView animation=\"rotateIn\" viewportOnce={true}\u003e\n  \u003cdiv className=\"card\"\u003e\n    \u003ch2\u003eRotating Card\u003c/h2\u003e\n    \u003cp\u003eThis card will rotate in once when it enters the viewport\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/AnimateOnView\u003e\n```\n\n### Staggered animation for multiple elements\n\n```jsx\n\u003cAnimateOnView animation=\"fadeInFromBottom\" staggerDelay={0.2}\u003e\n  \u003ch2\u003eStaggered Animation\u003c/h2\u003e\n  \u003cp\u003eThis paragraph appears after the heading\u003c/p\u003e\n  \u003cbutton\u003eThis button comes last\u003c/button\u003e\n\u003c/AnimateOnView\u003e\n```\n\n### Complex layout with mixed animations\n\n```jsx\n\u003cdiv className=\"container\"\u003e\n  \u003cAnimateOnView animation=\"fadeInFromLeft\"\u003e\n    \u003ch1\u003eWelcome to My Site\u003c/h1\u003e\n  \u003c/AnimateOnView\u003e\n\n  \u003cAnimateOnView animation=\"fadeInFromBottom\" staggerDelay={0.15}\u003e\n    \u003cp\u003eHere's some introductory text.\u003c/p\u003e\n    \u003cbutton\u003eCall to Action\u003c/button\u003e\n    \u003cdiv className=\"image-gallery\"\u003e\n      \u003cimg src=\"image1.jpg\" alt=\"Image 1\" /\u003e\n      \u003cimg src=\"image2.jpg\" alt=\"Image 2\" /\u003e\n      \u003cimg src=\"image3.jpg\" alt=\"Image 3\" /\u003e\n    \u003c/div\u003e\n  \u003c/AnimateOnView\u003e\n\n  \u003cAnimateOnView animation=\"zoomIn\" viewportAmount={0.3}\u003e\n    \u003cfooter\u003e\n      \u003cp\u003e© 2024 My Company\u003c/p\u003e\n    \u003c/footer\u003e\n  \u003c/AnimateOnView\u003e\n\u003c/div\u003e\n```\n\n## Contributing\n\nContributions are always welcome! Here's how you can help:\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\nPlease make sure to update tests as appropriate and adhere to the existing coding style.\n\n### Development\n\nTo set up the development environment:\n\n1. Clone the repository\n2. Install dependencies with `npm install`\n3. Run the build process with `npm run build`\n4. To test your changes, you can use `npm link` in the package directory and then `npm link react-animate-onview` in your test project\n\n### Reporting Issues\n\nIf you find a bug or have a feature request, please open an issue on the GitHub repository. Provide as much information as possible, including steps to reproduce the issue if applicable.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Thanks to [Framer Motion](https://www.framer.com/motion/) for providing the animation capabilities.\n- Inspired by the need for simple, reusable animation components in React applications.\n\n---\n\nMade with ❤️ by Randil Withanage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandilt%2Freact-animate-onview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandilt%2Freact-animate-onview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandilt%2Freact-animate-onview/lists"}