diff --git a/.fallowrc.jsonc b/.fallowrc.jsonc index 7c85694fc3..6805a6b36f 100644 --- a/.fallowrc.jsonc +++ b/.fallowrc.jsonc @@ -491,6 +491,12 @@ // complexity pre-dates the computed-timeline work. Exempted at file level // rather than refactored as scope creep. "ignore": [ + // AnimationCard.tsx / EaseCurveSection.tsx: pre-existing large components + // (360/276-line render functions) re-flagged by the easing-picker + // consolidation, which only removed a select from one and added a small + // select to the other. Splitting them is out of scope here. + "packages/studio/src/components/editor/AnimationCard.tsx", + "packages/studio/src/components/editor/EaseCurveSection.tsx", // sourcePatcher.ts: resolveSourceFile / splitInlineStyleDeclarations / // patch*InTag pre-date this PR; only the PatchOperation type gained two // optional fields, but the line-shift fingerprint re-flags the inherited diff --git a/packages/studio/src/components/editor/AnimationCard.tsx b/packages/studio/src/components/editor/AnimationCard.tsx index 0a0a327e7a..b74c2eb019 100644 --- a/packages/studio/src/components/editor/AnimationCard.tsx +++ b/packages/studio/src/components/editor/AnimationCard.tsx @@ -1,9 +1,8 @@ import { memo, useCallback, useMemo, useState } from "react"; import type { GsapAnimation } from "@hyperframes/core/gsap-parser"; -import { SUPPORTED_EASES, SUPPORTED_PROPS } from "@hyperframes/core/gsap-constants"; +import { SUPPORTED_PROPS } from "@hyperframes/core/gsap-constants"; import { RESPONSIVE_GRID } from "./propertyPanelHelpers"; -import { MetricField, SelectField } from "./propertyPanelPrimitives"; -import { controlPointsForGsapEase } from "./studioMotion"; +import { MetricField } from "./propertyPanelPrimitives"; import { EASE_LABELS, METHOD_LABELS, METHOD_TOOLTIPS, PROP_LABELS } from "./gsapAnimationConstants"; import { buildTweenSummary } from "./gsapAnimationHelpers"; import { EaseCurveSection } from "./EaseCurveSection"; @@ -257,33 +256,14 @@ export const AnimationCard = memo(function AnimationCard({ } /> ) : ( - <> - { - const easeKey = animation.keyframes ? "easeEach" : "ease"; - if (next === "custom") { - const points = controlPointsForGsapEase( - easeName !== "none" ? easeName : "power2.out", - ); - const path = `M0,0 C${points.x1},${points.y1} ${points.x2},${points.y2} 1,1`; - onUpdateMeta(animation.id, { [easeKey]: `custom(${path})` }); - } else { - onUpdateMeta(animation.id, { [easeKey]: next }); - } - }} - /> - { - const easeKey = animation.keyframes ? "easeEach" : "ease"; - onUpdateMeta(animation.id, { [easeKey]: customEase }); - }} - /> - + { + const easeKey = animation.keyframes ? "easeEach" : "ease"; + onUpdateMeta(animation.id, { [easeKey]: customEase }); + }} + /> )} )} diff --git a/packages/studio/src/components/editor/EaseCurveSection.tsx b/packages/studio/src/components/editor/EaseCurveSection.tsx index 262ff6a9f9..cd76f107d5 100644 --- a/packages/studio/src/components/editor/EaseCurveSection.tsx +++ b/packages/studio/src/components/editor/EaseCurveSection.tsx @@ -1,5 +1,7 @@ import { useCallback, useRef, useState } from "react"; +import { SUPPORTED_EASES } from "@hyperframes/core/gsap-constants"; import { EASE_CURVES, EASE_LABELS, parseCustomEaseFromString } from "./gsapAnimationConstants"; +import { SelectField } from "./propertyPanelPrimitives"; import { roundToCenti } from "../../utils/rounding"; // Figma-canonical ordering: linear, the three core eases, then the expressive @@ -15,6 +17,12 @@ const PRESET_GRID_EASES = [ "expo.out", ] as const; +const ADDITIONAL_CURVE_EASES = SUPPORTED_EASES.filter( + (name) => EASE_CURVES[name] && !PRESET_GRID_EASES.some((preset) => preset === name), +); +const NON_CURVE_EASES = SUPPORTED_EASES.filter((name) => !EASE_CURVES[name]); +const ADDITIONAL_EASES = [...ADDITIONAL_CURVE_EASES, ...NON_CURVE_EASES]; + function MiniCurveSvg({ curve, active, @@ -149,8 +157,7 @@ export function EaseCurveSection({ }, []); const active = draft ?? curve; - if (!active) return null; - const [x1, y1, x2, y2] = active; + const [x1, y1, x2, y2] = active ?? EASE_CURVES.none; // Anchors + control handles. Handle *display* is clamped to the view so an // extreme loaded overshoot rides the edge instead of disappearing. @@ -217,150 +224,174 @@ export function EaseCurveSection({ return (
onCustomEaseCommit(name)} /> +
+ onCustomEaseCommit(next)} + /> +
Speed curve - + {active && ( + + )}
-
- - {/* Grid — quarter lines inside the unit square */} - {[0.25, 0.5, 0.75].map((q) => ( - - ))} - {[0.25, 0.5, 0.75].map((q) => ( - - ))} - {/* Unit-square frame (progress 0 → 1) */} - - {/* Linear reference diagonal */} - - {/* Tangent handle lines */} - - - {/* The curve */} - - {/* Anchors at (0,0) and (1,1) */} - - - {/* Animated preview dot */} - {dot && ( - <> - - - - )} - {/* Draggable control handles (large transparent hit area + visible dot) */} - {[["p1", p1] as const, ["p2", p2] as const].map(([key, pt]) => ( - - handlePointerDown(key, e)} - onPointerEnter={() => setHover(key)} - onPointerLeave={() => setHover((h) => (h === key ? null : h))} + {active ? ( + <> +
+ + {/* Grid — quarter lines inside the unit square */} + {[0.25, 0.5, 0.75].map((q) => ( + + ))} + {[0.25, 0.5, 0.75].map((q) => ( + + ))} + {/* Unit-square frame (progress 0 → 1) */} + - + {/* Tangent handle lines */} + + + {/* The curve */} + - - ))} - -
- {/* Axis + value readout */} -
- {duration != null && duration > 0 ? "0s" : "start"} - time → - {duration != null && duration > 0 ? `${duration}s` : "end"} -
-
- {label} - - {bezierText} - -
+ {/* Anchors at (0,0) and (1,1) */} + + + {/* Animated preview dot */} + {dot && ( + <> + + + + )} + {/* Draggable control handles (large transparent hit area + visible dot) */} + {[["p1", p1] as const, ["p2", p2] as const].map(([key, pt]) => ( + + handlePointerDown(key, e)} + onPointerEnter={() => setHover(key)} + onPointerLeave={() => setHover((h) => (h === key ? null : h))} + /> + + + ))} + +
+ {/* Axis + value readout */} +
+ {duration != null && duration > 0 ? "0s" : "start"} + time → + {duration != null && duration > 0 ? `${duration}s` : "end"} +
+
+ {label} + + {bezierText} + +
+ + ) : ( +

+ {label} has no editable curve preview. +

+ )}
); }