{"_id":"bezier-easing@3.2.0","bugs":{"url":"https://github.com/gre/bezier-easing/issues"},"dist":{"shasum":"de7661ebcd79797ab02d46458f7a7fa1d4ae6273","tarball":"http://registry-npm.ywwl.com/bezier-easing/download/bezier-easing-3.2.0.tgz","fileCount":8,"integrity":"sha512-QOKIYCgHd06gsQg0G9k1/JnzzZ+PT99qqUmgRHQ+r5PI/gsjCn0l7LXW6gtXoPhVJviIjP01xg9E7eNime9fVw==","signatures":[{"sig":"MEQCIFdpbIVUhkX59PgZekVfX6YmNqmv4IzVg/9BLfWzOMP/AiAuHuSlgGJc3ngKmetw2aYBB+Kn/OO15W7uw3885FVhog==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDNvLBIGPmN305DcP3sXcrYY3jJSTJ/8KnnK7lFBQLtyQIgWk39TKJmAShhWsE2ENT+U+VWHFmN0oQsteXR2Y0sfdM="}],"unpackedSize":17773,"size":6301,"noattachment":false,"key":"/bezier-easing/-/bezier-easing-3.2.0.tgz"},"main":"./src/index.js","name":"bezier-easing","type":"module","types":"src/index.d.ts","author":{"name":"Gaëtan Renaudeau","email":"renaudeau.gaetan@gmail.com"},"exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js","require":"./dist/bezier-easing.cjs"}},"gitHead":"6b423c61f5d7c4464061afc724cd951b7c22cae2","license":"MIT","scripts":{"lint":"eslint .","test":"vitest run","format":"prettier --write .","benchmark":"node benchmark.js","build-cjs":"esbuild src/index.js --bundle --format=cjs --footer:js='module.exports = module.exports.default;' --outfile=dist/bezier-easing.cjs","build-dev":"esbuild src/index.js --bundle --global-name=BezierEasing --outfile=dist/bezier-easing.js","build-prod":"esbuild src/index.js --bundle --global-name=BezierEasing --minify --outfile=dist/bezier-easing.min.js","prepublish":"rm -rf dist && mkdir -p dist && npm run build-cjs && npm run build-dev && npm run build-prod","format:check":"prettier --check ."},"version":"3.2.0","_npmUser":{"name":"gre","email":"renaudeau.gaetan@gmail.com"},"homepage":"https://github.com/gre/bezier-easing#readme","keywords":["cubic-bezier","bezier","easing","interpolation","animation","timing","timing-function"],"repository":{"url":"git://github.com/gre/bezier-easing.git","type":"git"},"_npmVersion":"11.5.1","description":"BezierEasing provides Cubic Bezier Curve easing which generalizes easing functions exactly like in CSS Transitions.","directories":{},"maintainers":[{"name":"gre","email":"renaudeau.gaetan@gmail.com"}],"_nodeVersion":"24.7.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.0.3","vitest":"^5.0.2","esbuild":"^0.28.1","prettier":"^3.8.1","benchmark":"^2.1.0","@eslint/js":"^10.0.1","eslint-config-prettier":"^10.1.8"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bezier-easing_3.2.0_1791386503992_0.7848505611621062"},"readme":"# bezier-easing\n\nBezierEasing provides **Cubic Bezier** Curve easing which generalizes easing functions (ease-in, ease-out, ease-in-out, ...any other custom curve) exactly like in CSS Transitions.\n\nImplementing efficient lookup is not easy because it implies projecting\nthe X coordinate to a Bezier Curve.\nThis micro library uses fast heuristics (involving dichotomic search, newton-raphson, sampling) to focus on **performance** and **precision**.\n\n> It is heavily based on implementations available in Firefox and Chrome (for the CSS transition-timing-function property).\n\n## Usage\n\n```javascript\nvar easing = BezierEasing(0, 0, 1, 0.5);\n// easing allows to project x in [0.0,1.0] range onto the bezier-curve defined by the 4 points (see schema below).\nconsole.log(easing(0.0)); // 0.0\nconsole.log(easing(0.5)); // 0.3125\nconsole.log(easing(1.0)); // 1.0\n// x outside [0.0,1.0] is clamped\nconsole.log(easing(1.5)); // 1.0\n```\n\n(this schema is from the CSS spec)\n\n[![TimingFunction.png](https://www.w3.org/TR/css-easing-1/images/cubic-bezier-easing-curve.svg)](https://www.w3.org/TR/css-easing-1/#cubic-bezier-easing-functions)\n\n> `BezierEasing(P1.x, P1.y, P2.x, P2.y)`\n\n## Install\n\n[![npm install bezier-easing](https://nodei.co/npm/bezier-easing.png)](https://npmjs.org/package/bezier-easing)\n\nIt is the equivalent to [CSS Transitions' `transition-timing-function`](http://www.w3.org/TR/css-easing-1/#cubic-bezier-easing-functions).\n\nIn the same way you can define in CSS `cubic-bezier(0.42, 0, 0.58, 1)`,\nwith BezierEasing, you can define it using `BezierEasing(0.42, 0, 0.58, 1)` which have the `` function taking an X and computing the Y interpolated easing value (see schema).\n\n## License\n\nMIT License.\n\n## Tests\n\n```\nnpm test\n```\n\n# See also\n\n- [https://github.com/gre/bezier-easing-editor/](https://github.com/gre/bezier-easing-editor/)\n\n# Who use it?\n\n- [React Native](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Animated/bezier.js)\n- [Apple®](https://www.apple.com/v/airpods-pro/t/built/scripts/overview/main.built.js) :)\n- [lottie-web](https://github.com/airbnb/lottie-web/blob/master/player/js/3rd_party/BezierEaser.js)\n- [Velocity.js](https://github.com/julianshapiro/velocity/blob/master/src/Velocity/easing/bezier.ts)\n- [ipo](https://github.com/gre/ipo)\n\n## More informations\n\nImplementation based on this [article](http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/).\n\n## Contributing\n\nYou need a `node` installed.\n\nInstall the deps:\n\n```\nnpm install\n```\n\nThe library is in `src/index.js`.\n\nEnsure any modification will:\n\n- keep validating the tests (run `npm test`)\n- not bring performance regression (compare with `npm run benchmark` – don't rely 100% on its precision but it still helps to notice big gaps)\n","publish_time":1791386504099,"_cnpm_publish_time":1791386504099,"dist-tags":{"latest":"3.2.0"}}