Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/motion-morph-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[chore] Internal: the rect morph's paths, the geometry touch presentations share when they grow out of a source rect and shrink back into it. `lerpPath` (a straight line between two rects) and `edgeGrowPath` (UIKit's popover, growing out of a point on its edge) name the rect an element shows at each progress, and say how an interrupted motion continues in their own law; `morphCurves` turns a path into compositor curves (`translate`, `scale` and a companion `opacity`). Not exported from the package entry point; no component uses them yet.

@vjeux
7 changes: 7 additions & 0 deletions .changeset/motion-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[chore] Internal: one progress module for the motion foundation. `progressCurve` gives a spring's progress from 0 to 1 as a closed-form curve, `mapProgress` maps any curve from another (a companion's dim following a sheet, a clamped range), `mapRange` is the clamped linear map they share, and `presentedProgressVelocity` reads the velocity an interrupted motion continues from. One velocity unit throughout: progress per second. Nothing public changes; no component imports it yet.

@vjeux
2 changes: 2 additions & 0 deletions packages/core/src/motion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ roles through `resolveMotion`.
| `resolveSnapPoint.ts` | Release policy: the snap point a release lands on (flick, back-out cancel, step limit), on `selectSnapPoint`. Internal. |
| `bezier.ts` | Cubic-bézier timing functions (Core Animation's named curves). |
| `animator.ts` | Compositor animator: springs, coasts and any closed-form curve compiled to Web Animations, read back analytically. |
| `morphPath.ts` | The rect an element shows at each progress of a grow-out presentation: a straight line, a popover’s edge growth, and the curves that put it there. |
| `progress.ts` | A spring's progress, one curve mapped from another (companions, clamped ranges), the velocity that continues a motion. |
| `presentation.ts` | Where each moving element is drawn relative to where the engine hit-tests it, reported by the animator while translate runs; read by the gesture host at touch-down. |
| `reducedMotionPlan.ts` | The animator's Reduce Motion planner: what one call becomes, a cross-fade whose travel lands while transparent or at once. |
| `__tests__/animator.interaction.browser.spec.ts` | Browser proofs on the interaction harness (Chromium and WebKit): busy main thread, end state through a block, no Layout / Paint, seeked curves, a dialog's backdrop. |
Expand Down
9 changes: 5 additions & 4 deletions packages/core/src/motion/animatedLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ import {
wrapText,
} from './transientCopy';
import {isSpring} from './roleValue';
import {solveSpring, toSpring, type SpringDescription} from './spring';
import {progressCurve} from './progress';
import type {SpringDescription} from './spring';
import {registerSpringsTable, SETTLE_SPRING} from './uikit/springs';
import {reducedMotionCrossFade} from './uikit/timing';

Expand Down Expand Up @@ -142,11 +143,11 @@ function settleSpring(): SpringDescription {
}

function springProgress(description: SpringDescription): SpringProgress {
const curve = solveSpring(toSpring(description), {from: 1, to: 0});
const durationMs = Math.max(1, curve.settleTime(0.001) * 1000);
const curve = progressCurve(description, {epsilon: 0.001});
const durationMs = Math.max(1, curve.duration * 1000);
return {
durationMs,
remaining: t => (t >= durationMs ? 0 : curve.value(t / 1000)),
remaining: t => (t >= durationMs ? 0 : 1 - curve.at(t / 1000)),
};
}

Expand Down
Loading