Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion docs/specs/AST-094-touch-presentations/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,10 @@ under a finger, and a mouse follows `module:DropdownMenu/useMenuPress` FR3 and
shrink plays on the theme's exit duration and easing (FR7). The shrink plays in full after the surface has
closed. This is its exit under FR7 (`family:overlay-dismissal` AV6); under
reduced motion FR8 applies. A menu or popover presented as a bottom sheet
follows the sheet instead.
follows the sheet instead. `motion/morphPath.ts` gives the rect a grow-out
presentation shows at each progress (a straight line, or a popover's edge
grow); `motion/rectMorph.ts` imports it; no other motion module maps a

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.

Non-blocking: motion/rectMorph.ts is not on main or at this head yet, so this clause makes the current record describe a file that does not exist until #9769 lands. Consider dropping "motion/rectMorph.ts imports it;" here and adding it with #9769.

progress to a rect.
- **FR32 — A pan outside dismisses.** Under a finger, an open anchored menu MUST close as a touch outside it
begins to pan, and at the lift of a tap or hold outside it. A Popover's
dismissal is unchanged. A pinch stays available over it: its surface
Expand Down
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