{"id":"dervexdev/react-spring","name":"react-spring","scope":"dervexdev","platform":"roblox","description":"A modern spring-physics based animation library for Roact inspired by react-spring","version":"3.0.0","latest":"3.0.0","versions":["3.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"jsdotlua/luau-polyfill":{"version":"^1.0.0","alias":"LuauPolyfill"},"howmanysmall/typed-promise":{"version":"^4.0.0","alias":"Promise"},"jsdotlua/react":{"version":"^17.0.0","alias":"React"},"jsdotlua/react-roblox":{"version":"^17.0.0","alias":"ReactRoblox"},"howmanysmall/better-signal":{"version":"^2.1.0","alias":"Signal"}},"integrity":"0629b9cdc6447e6808180234abda720677d2c2b0ed3d0501b412ba1610266a75","likes":0,"downloads":0,"install":"forest install dervexdev/react-spring","url":"https://forest.dev/p/roblox/dervexdev/react-spring","files":"https://api.forest.dev/ai/package/roblox/dervexdev/react-spring/files","readme":"<a href=\"https://www.chrisc.dev/roact-spring/\">\n  <p align=\"center\">\n    <img src=\"https://i.imgur.com/1Ta6WRv.png\" width=\"200\" />\n  </p>\n</a>\n\n<h1 align=\"center\">roact-spring</h1>\n<h3 align=\"center\">A modern spring-physics based </br> animation library for Roact inspired by react-spring</h3>\n\n<br>\n\n<div align=\"center\">\n  <a href=\"https://github.com/chriscerie/roact-spring/actions/workflows/docs.yml\">\n    <img src=\"https://github.com/chriscerie/roact-spring/workflows/docs/badge.svg\" alt=\"Deploy Docs Status\"/>\n  </a>\n  <a href=\"https://badge.fury.io/js/@rbxts%2Froact-spring\">\n    <img src=\"https://badge.fury.io/js/@rbxts%2Froact-spring.svg\" alt=\"npm version\" height=\"18\">\n  </a>\n</div>\n\n<br>\n\n## Why roact-spring\n\n### Declarative and imperative\n\n`roact-spring` is the perfect bridge between declarative and imperative animations. It takes the best of both worlds and packs them into one flexible library.\n\n### Fluid, powerful, painless\n\n`roact-spring` is designed to make animations fluid, powerful, and painless to build and maintain. Animation becomes easy and approachable, and everything you do look and feel natural by default.\n\n### Versatile\n\n`roact-spring` works with most data types and provides extensible configurations that makes it painless to create advanced animations.\n\n## Installation\n\n### Wally\n\n`roact-spring` has two packages to support [react-lua](https://github.com/jsdotlua/react-lua) and [legacy Roact](https://github.com/Roblox/roact). It's crucial to install the correct package or you **will** encounter bugs. To install, add the latest version of roact-spring to your wally.toml:\n\n#### With react-lua\n\n```console\nReactSpring = \"chriscerie/react-spring@<version>\"\n```\n\nNote: react-lua packages under the scope jsdotlua must use react-spring >= 2.0. react-lua packages under the legacy scope corepackages must use react-spring v1.\n\n#### With legacy Roact\n\n```console\nRoactSpring = \"chriscerie/roact-spring@<version>\"\n```\n\n### roblox-ts\n\n`roact-spring` is also available for roblox-ts projects. Install it with [npm](https://www.npmjs.com/package/@rbxts/roact-spring):\n\n```console\nnpm i @rbxts/roact-spring\n```\n\n## Getting Started\n\nGetting started with roact-spring is as simple as:\n\n### Declarative\n\n```lua\nlocal toggle, setToggle = React.useState(false)\nlocal styles = RoactSpring.useSpring({\n    transparency = if toggle then 1 else 0,\n})\n\n-- Later\nsetToggle(function(prevState)\n    return not prevState\nend)\n```\n\n### Imperative\n\n```lua\nlocal styles, api = RoactSpring.useSpring(function()\n    return {\n        position = UDim2.fromScale(0.3, 0.3),\n        rotation = 0,\n    }\n})\n\n-- Later\napi.start({\n    position = UDim2.fromScale(0.5, 0.5),\n    rotation = 45,\n    config = { tension = 170, friction = 26 },\n})\n```\n\nMore information can be found in roact-spring's official [documentation](https://www.chrisc.dev/roact-spring/).\n\n## Demos\n\nThese demos are publicly available. Click on each gif to go to their source.\n\n### Draggable element\n\n<a href=\"stories/hooks/useSpringDrag.story.lua\">\n  <img src=\"https://media.giphy.com/media/R2bJ57MNTdP7vmP6Ez/giphy.gif\" width=\"300\" />\n</a>\n\n### Draggable list\n\n<a href=\"stories/hooks/useSpringsList.story.lua\">\n  <img src=\"https://media.giphy.com/media/4qOEZ93YjhfKtSlx7b/giphy.gif\" width=\"300\" />\n</a>\n\n### Staggered list\n\n<a href=\"stories/hooks/useTrailList.story.lua\">\n  <img src=\"https://media.giphy.com/media/XfG0GNKGCKang91lLN/giphy.gif\" width=\"300\" />\n</a>\n\n### Staggered text\n\n<a href=\"stories/hooks/useTrailText.story.lua\">\n  <img src=\"https://media.giphy.com/media/9llkynmhlsUvZCupPz/giphy.gif\" width=\"300\" />\n</a>\n\n### Trailing elements\n\n<a href=\"stories/hooks/useTrailFollow.story.lua\">\n  <img src=\"https://media.giphy.com/media/BS20XRr522AJgkCyZR/giphy.gif\" width=\"300\" />\n</a>\n\n## License\n\n`roact-spring` is available under the MIT license. See [LICENSE](LICENSE) for details.\n","readmeTruncated":false}