{"id":26529015,"url":"https://github.com/faustienf/easing-scroll","last_synced_at":"2025-08-01T13:41:17.683Z","repository":{"id":65147120,"uuid":"583656689","full_name":"faustienf/easing-scroll","owner":"faustienf","description":"♿️ Smooth scrolling","archived":false,"fork":false,"pushed_at":"2023-04-29T08:55:57.000Z","size":47,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-08T15:46:58.285Z","etag":null,"topics":["animation-scroll","easing-scroll","scroll","smooth-scroll","smooth-scrolling"],"latest_commit_sha":null,"homepage":"https://easing-scroll.vercel.app","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/faustienf.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}},"created_at":"2022-12-30T13:21:54.000Z","updated_at":"2023-04-29T17:32:51.000Z","dependencies_parsed_at":"2023-02-02T17:03:28.909Z","dependency_job_id":null,"html_url":"https://github.com/faustienf/easing-scroll","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Feasing-scroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Feasing-scroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Feasing-scroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Feasing-scroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faustienf","download_url":"https://codeload.github.com/faustienf/easing-scroll/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244825652,"owners_count":20516592,"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":["animation-scroll","easing-scroll","scroll","smooth-scroll","smooth-scrolling"],"created_at":"2025-03-21T16:20:17.145Z","updated_at":"2025-03-21T16:20:17.987Z","avatar_url":"https://github.com/faustienf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easing-scroll\n\n[![npm-version](https://img.shields.io/npm/v/easing-scroll.svg)](https://npmjs.org/package/easing-scroll)\n\n♿️ Smooth scrolling. [Demo](https://easing-scroll.vercel.app).\n\n## Install\n\n```sh\nnpm install easing-scroll\n```\n\n## Features\n\n- 📦 Zero dependencies\n- 📈 Customize [easing function](https://easings.net)\n- 🚫 Abort scrolling ([AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal))\n- 🔄 Waiting for animation to end\n- ☸️ Supports vertical and horizontal scroll\n\n## Usage\n\n```ts\nimport { easingScroll } from \"easing-scroll\";\n\nconst controller = new AbortController();\n// Abort scrolling\n// controller.abort(); ❌\n\nconst target = document.querySelector(\".container\");\n\nconst progress = await easingScroll(target, {\n  left: 0, // px\n  top: 300, // px\n  duration: 400, // ms\n  signal: controller.signal,\n  // 👀 https://easings.net/#easeOutCubic\n  easing: (x) =\u003e 1 - Math.pow(1 - x, 3),\n});\n\nif (progress === 1) {\n  console.log(\"Completed\");\n} else {\n  console.log(\"Aborted\");\n}\n```\n\n### Animation\n\nLinear function `(t) =\u003e t` is used by default. Pass [easing](https://easings.net), if you want to change easing function.\n`duration` is animation duration in milliseconds.\n\n```ts\neasingScroll(target, {\n  duration: 400, // ms\n  // 👀 https://easings.net/#easeOutCubic\n  easing: (x) =\u003e 1 - Math.pow(1 - x, 3),\n});\n```\n\n### Abort scrolling\n\nPass `signal` ([AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)),\nif you want to abort scrolling.\n\n```ts\nconst controller = new AbortController();\nsetTimeout(() =\u003e {\n  controller.abort();\n}, 100);\n\nconst progress = await easingScroll(target, {\n  ...,\n  signal: controller.signal,\n});\n\nif (progress !== 1) {\n  console.log('Scrolling has been aborted.');\n}\n```\n\n`progress` is a number from _0_ to _1_.\n\n`1` - Scrolling is completed _100%_.\n\n`\u003c1` - Scrolling has been aborted and completed _x%_.\n\n```ts\nconst progress = await easingScroll(target, {\n  ...,\n});\n\nif (progress !== 1) {\n  console.log('Scrolling has been aborted.');\n} else {\n  console.log('Completed.');\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaustienf%2Feasing-scroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaustienf%2Feasing-scroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaustienf%2Feasing-scroll/lists"}