feat(motion): add interpolate and mapRange helper#689
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds numeric interpolation utilities to the ChangesInterpolation Helpers
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds numeric interpolation utilities to @termuijs/motion, including a low-level range mapper and a tuple-based convenience wrapper, and exposes them via the package entrypoint with accompanying Vitest coverage.
Changes:
- Added
mapRangeandinterpolatehelpers with optional clamping behavior. - Added Vitest tests covering default clamping, extrapolation, descending output ranges, and zero-width input ranges.
- Exported the new helpers and option type from
packages/motion/src/index.ts.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/motion/src/interpolate.ts | Introduces mapRange and interpolate implementations and option type. |
| packages/motion/src/interpolate.test.ts | Adds unit tests validating interpolation behavior and clamping. |
| packages/motion/src/index.ts | Re-exports the new helpers/types from the package entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export { mapRange, interpolate } from './interpolate.js'; | ||
| export type { InterpolateOptions } from './interpolate.js'; |
Description
Adds mapRange and interpolate helpers to @termuijs/motion for mapping values between numeric ranges, with support for clamping, extrapolation, descending ranges, and safe handling of zero-width input ranges.
Related Issue
Closes #493
Which package(s)?
@termuijs/motion
Type of Change
type:bug)type:feature)type:docs)type:testing)type:refactor)type:design)type:accessibility)type:performance)type:devops)type:security)Checklist
needs-starcheck blocks your merge otherwise.bun vitest runbun run buildbun run typecheckCONTRIBUTING.md.type: short description.markDirty()(if your change affects rendering).anytypes without an inline comment explaining why.GSSoC 2026 Participation
https://gssoc.girlscript.org/profile/f49aa65e-aab2-4e9f-99d6-2174f339ecfeScreenshots / Recordings (UI changes)
(N/A - Pure mathematical utility functions with no UI)
Notes for the Reviewer
Summary by CodeRabbit
New Features
Tests