{"id":16127211,"url":"https://github.com/neiltron/react-gsap-transition","last_synced_at":"2025-07-20T00:33:35.476Z","repository":{"id":143905397,"uuid":"53372741","full_name":"neiltron/react-gsap-transition","owner":"neiltron","description":"Connect ReactTransitionGroup and GSAP to stagger item entrances and exits","archived":false,"fork":false,"pushed_at":"2016-03-10T18:52:47.000Z","size":13,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-22T21:02:19.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/neiltron.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":"2016-03-08T01:35:24.000Z","updated_at":"2023-03-30T11:26:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"8aabd738-fae7-4a16-8f93-fb761a914bc7","html_url":"https://github.com/neiltron/react-gsap-transition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/neiltron/react-gsap-transition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiltron%2Freact-gsap-transition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiltron%2Freact-gsap-transition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiltron%2Freact-gsap-transition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiltron%2Freact-gsap-transition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neiltron","download_url":"https://codeload.github.com/neiltron/react-gsap-transition/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiltron%2Freact-gsap-transition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266048682,"owners_count":23868743,"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-10-09T21:43:17.559Z","updated_at":"2025-07-20T00:33:35.454Z","avatar_url":"https://github.com/neiltron.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-gsap-transition\n[![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Dev Dependency Status][daviddm-dev-image]][daviddm-url]\n\nCreates an easy bridge between ReactTransitionGroup and GSAP. This is specifically helpful with staggering a group of items in/out of view with a TweenMax-based tween on enter/leave.\n\nIf GSAP isn't a requirement for your project, you might be better off with something like [react-motion](https://github.com/chenglou/react-motion).\n\n## Installation\n\n```sh\n$ npm install --save react-gsap-transition\n```\n\n## Usage\n\nSetup the component child element that will be transitioning. All tween values are optional and should be added to the component state. In this example they are setup in `_animationOpts`.\n\nNote the item being tweened should have a `ref` of `el`.\n\n```js\nimport React from 'react'\nimport GSAPTransitionItem from 'react-gsap-transition'\n\nexport default class extends GSAPTransitionItem {\n  constructor(props) {\n    super(props)\n\n    this.state = {\n      animationOpts: this._animationOptions()\n    }\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\u003cspan ref='el'\u003e{this.props.text}\u003c/span\u003e\u003c/div\u003e\n    )\n  }\n\n  _animationOptions() {\n    return {\n      staggerSpeed:   .1,\n      beforeEnter:    { y: '-5%', opacity: 0 },\n      enterAnimation: { y: '0%',  opacity: 1 },\n      leaveAnimation: { y: '5%',  opacity: 0 }\n    }\n  }\n}\n```\n\nAnd to use it, your parent component should look something like this:\n\n```js\nimport React from 'react'\nimport MyTweenedComponent from 'my_tween_component.js'\n\nexport default class extends React.Component {\n  constructor(props) {\n    super(props)\n\n    this.state = { leaving: false }\n  }\n\n  render() {\n    return (\n      \u003cdiv onClick={this._onClick}\u003e\n        \u003cReactTransitionGroup\u003e\n          {this._items()}\n        \u003c/ReactTransitionGroup\u003e\n      \u003c/div\u003e\n    )\n  }\n\n  _onClick() {\n    this.setState({ leaving: !this.state.leaving })\n  }\n\n  _items() {\n    let items = ['a', 'group', 'of', 'words']\n\n    if (!this.state.leaving) {\n      return items.map(item, i) {\n        let onComplete = (i == items.length - 1) ? this._onComplete.bind(this) : () =\u003e {}\n\n        \u003cMyTweenedComponent\n          text={item}\n          key={item}\n          index={i}\n          total={items.length}\n          onComplete={onComplete}\n          /\u003e\n      }\n    }\n  }\n}\n```\n## License\n\nMIT © [Neil Pullman](http://descend.org)\n\n\n[npm-image]: https://badge.fury.io/js/react-gsap-transition.svg\n[npm-url]: https://npmjs.org/package/react-gsap-transition\n[daviddm-image]: https://david-dm.org/neiltron/react-gsap-transition.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/neiltron/react-gsap-transition\n[daviddm-dev-image]: https://david-dm.org/neiltron/react-gsap-transition/dev-status.svg?theme=shields.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneiltron%2Freact-gsap-transition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneiltron%2Freact-gsap-transition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneiltron%2Freact-gsap-transition/lists"}