From 401cc35743aafc4c8bdfb8055501650390bde88b Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 29 Apr 2026 10:37:39 +0200 Subject: refactor: animate params over time --- apps/web/src/timeline/animation-targets.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'apps/web/src/timeline/animation-targets.ts') diff --git a/apps/web/src/timeline/animation-targets.ts b/apps/web/src/timeline/animation-targets.ts index fcdb2915..4ee764b6 100644 --- a/apps/web/src/timeline/animation-targets.ts +++ b/apps/web/src/timeline/animation-targets.ts @@ -1,8 +1,6 @@ import type { - AnimationBindingKind, AnimationInterpolation, AnimationPath, - AnimationValue, NumericSpec, } from "@/animation/types"; import { @@ -16,9 +14,11 @@ import { getGraphicDefinition } from "@/graphics"; import { coerceParamValue, getParamDefaultInterpolation, + getParamChannelLayout, getParamNumericRange, - getParamValueKind, + type ParamChannelLayout, type ParamDefinition, + type ParamValue, type ParamValues, } from "@/params"; import { @@ -28,17 +28,16 @@ import type { TimelineElement } from "@/timeline"; import { isVisualElement } from "@/timeline/element-utils"; export interface AnimationPathDescriptor { - kind: AnimationBindingKind; + channelLayout: ParamChannelLayout; defaultInterpolation: AnimationInterpolation; numericRanges?: Partial>; - coerceValue: ({ value }: { value: AnimationValue }) => AnimationValue | null; - getBaseValue: () => AnimationValue | null; - setBaseValue: ({ value }: { value: AnimationValue }) => TimelineElement; + coerceValue: ({ value }: { value: ParamValue }) => ParamValue | null; + getBaseValue: () => ParamValue | null; + setBaseValue: ({ value }: { value: ParamValue }) => TimelineElement; } -// Number/discrete bindings expose a single component named "value" -// (see binding-values.ts). Multi-component kinds (vector2, color) don't carry -// numeric ranges yet — revisit when one does. +// Leaf params expose a single component named "value". Composite params don't +// carry numeric ranges yet — revisit when one does. function paramNumericRanges({ param, }: { @@ -62,7 +61,7 @@ function buildParamDescriptor({ } return { - kind: getParamValueKind({ param }), + channelLayout: getParamChannelLayout({ param }), defaultInterpolation: getParamDefaultInterpolation({ param }), numericRanges: paramNumericRanges({ param }), coerceValue: ({ value }) => coerceParamValue({ param, value }), -- cgit v1.3.1