Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 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
17 changes: 14 additions & 3 deletions packages/core/src/Popover/popoverSurfaceMotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ export type {
/**
* The curves from `from` to `to` as `progress` moves from 0 to 1. The scale
* and the length move together, so the scale along the axis is their product.
*
* @internal Read by the rect morph's popover proofs; not exported from the
* package.
*/
function surfaceCurves(
export function surfaceCurves(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss, non-blocking: this file's header still lists only popoverCollapsedState, popoverFrame and createPopoverSurfaceMotion under @output (lines 10-12), and its SYNC: list (lines 16-19) does not name motion/morphPath.test.ts, which now imports surfaceCurves and readState. Adding both exports to @output and the test to SYNC: reminds whoever edits these two functions that the morph's proofs replay them.

from: SurfaceState,
to: SurfaceState,
axis: 'x' | 'y',
Expand All @@ -82,8 +85,16 @@ function timingOn(element: Element, tokens: ThemeTimingTokens): MotionCurve {
return readThemeTiming(element, tokens) ?? easedProgress(0, x => x);
}

/** What `animator` shows now, split back into scale and length. */
function readState(animator: Animator, axis: 'x' | 'y'): SurfaceState {
/**
* What `animator` shows now, split back into scale and length.
*
* @internal Read by the rect morph's popover proofs; not exported from the
* package.
*/
export function readState(
animator: Pick<Animator, 'get'>,
axis: 'x' | 'y',
): SurfaceState {
const across = animator.get(axis === 'x' ? 'scaleY' : 'scaleX');
const along = animator.get(axis === 'x' ? 'scaleX' : 'scaleY');
return {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/motion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ 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. |
Expand Down
Loading
Loading