{"id":"destruction-studios/flipper","name":"flipper","scope":"destruction-studios","platform":"roblox","description":"A motion library for Roact","version":"2.0.14","latest":"2.0.14","versions":["2.0.0","2.0.1","2.0.2","2.0.3","2.0.4","2.0.5","2.0.6","2.0.7","2.0.8","2.0.9","2.0.10","2.0.11","2.0.12","2.0.13","2.0.14"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"a106c3d9ee3312c6ca7edc934e019560a140ba0693485918abe8ae45d55ba115","likes":0,"downloads":0,"install":"forest install destruction-studios/flipper","url":"https://forest.dev/p/roblox/destruction-studios/flipper","files":"https://api.forest.dev/ai/package/roblox/destruction-studios/flipper/files","readme":"<p align=\"center\">\r\n\t<img src=\".github/logo.svg\" height=\"180\">\r\n\t<br>\r\n\tFlipper is an animation library for Roblox based around Motors and Goals.\r\n</p>\r\n\r\n# Installation\r\n\r\n## Rojo\r\n\r\n### 0.6.x+\r\n\r\nAdd this repository as a submodule into your packages directory. This example assumes the directory is `packages`.\r\n\r\n```\r\ngit submodule add https://github.com/Reselim/Flipper packages/Flipper\r\n```\r\n\r\n### 0.5.x\r\n\r\nCopy the `src` folder from this repository into your packages directory.\r\n\r\n## npm (for roblox-ts)\r\n\r\nInstall the [`@rbxts/flipper`](https://www.npmjs.com/package/@rbxts/flipper) package using `npm` or `yarn`.\r\n\r\n```\r\nnpm i @rbxts/flipper\r\n```\r\n\r\n## Without Rojo\r\n\r\nDownload the latest .rbxm file from [the releases page](https://github.com/Reselim/Flipper/releases) and drag it into studio.\r\n\r\n# Usage\r\n\r\n## With Roact\r\n\r\nThis example creates a button that shrinks when pressed.\r\n\r\n```lua\r\nlocal Example = Roact.Component:extend(\"Example\")\r\n\r\nfunction Example:init()\r\n\tself.motor = Flipper.SingleMotor.new(0)\r\n\r\n\tlocal binding, setBinding = Roact.createBinding(self.motor:getValue())\r\n\tself.binding = binding\r\n\r\n\tself.motor:onStep(setBinding)\r\nend\r\n\r\nfunction Example:render()\r\n\treturn Roact.createElement(\"ImageButton\", {\r\n\t\tSize = self.binding:map(function(value)\r\n\t\t\treturn UDim2.new(0, 100, 0, 100):Lerp(UDim2.new(0, 80, 0, 80), value)\r\n\t\tend),\r\n\t\tPosition = UDim2.new(0.5, 0, 0.5, 0),\r\n\t\tAnchorPoint = Vector2.new(0.5, 0.5),\r\n\r\n\t\t[Roact.Event.MouseButton1Down] = function()\r\n\t\t\tself.motor:setGoal(Flipper.Spring.new(1, {\r\n\t\t\t\tfrequency = 5,\r\n\t\t\t\tdampingRatio = 1\r\n\t\t\t}))\r\n\t\tend,\r\n\r\n\t\t[Roact.Event.MouseButton1Up] = function()\r\n\t\t\tself.motor:setGoal(Flipper.Spring.new(0, {\r\n\t\t\t\tfrequency = 4,\r\n\t\t\t\tdampingRatio = 0.75\r\n\t\t\t}))\r\n\t\tend\r\n\t})\r\nend\r\n\r\nreturn Example\r\n```\r\n\r\nFlipper works wonderfully with Roact on its own, but if you plan on using it for a lot of your components, [roact-flipper](https://github.com/Reselim/roact-flipper) will make that *much* easier.\r\n\r\n## Without Roact\r\n\r\nCheck out the [demo script](test/demo.client.lua) in the test project!\r\n\r\n# License\r\n\r\nFlipper is licensed in full under the [MIT license](LICENSE). Note that it [contains code](src/Spring.lua) from another author, which is also under the MIT license.","readmeTruncated":false}