diff options
| author | Maze <mazewinther@gmail.com> | 2026-04-06 01:13:14 +0200 |
|---|---|---|
| committer | Maze <mazewinther@gmail.com> | 2026-04-06 01:13:14 +0200 |
| commit | dedb13546a16235e7d6649961d0c9b235f62aa34 (patch) | |
| tree | 08b6e14bf6b28b4c8dc8bc9f849246c75f921593 /apps/web/src/core/managers/timeline-manager.ts | |
| parent | 099746633183cd061fc89a63aeb9fcfb909f6db2 (diff) | |
| download | opencut-dedb13546a16235e7d6649961d0c9b235f62aa34.tar.gz | |
feat: graphs popover
Diffstat (limited to 'apps/web/src/core/managers/timeline-manager.ts')
| -rw-r--r-- | apps/web/src/core/managers/timeline-manager.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/apps/web/src/core/managers/timeline-manager.ts b/apps/web/src/core/managers/timeline-manager.ts index 6f262e57..d5da1003 100644 --- a/apps/web/src/core/managers/timeline-manager.ts +++ b/apps/web/src/core/managers/timeline-manager.ts @@ -11,6 +11,7 @@ import type { AnimationPath, AnimationInterpolation, AnimationValue, + ScalarCurveKeyframePatch, } from "@/lib/animation/types"; import { calculateTotalDuration } from "@/lib/timeline"; import { getLastFrameTime } from "opencut-wasm"; @@ -36,6 +37,7 @@ import { UpsertKeyframeCommand, RemoveKeyframeCommand, RetimeKeyframeCommand, + UpdateScalarKeyframeCurveCommand, AddClipEffectCommand, RemoveClipEffectCommand, UpdateClipEffectParamsCommand, @@ -549,6 +551,45 @@ export class TimelineManager { this.editor.command.execute({ command }); } + updateKeyframeCurves({ + keyframes, + }: { + keyframes: Array<{ + trackId: string; + elementId: string; + propertyPath: AnimationPath; + componentKey: string; + keyframeId: string; + patch: ScalarCurveKeyframePatch; + }>; + }): void { + if (keyframes.length === 0) { + return; + } + + const commands = keyframes.map( + ({ + trackId, + elementId, + propertyPath, + componentKey, + keyframeId, + patch, + }) => + new UpdateScalarKeyframeCurveCommand({ + trackId, + elementId, + propertyPath, + componentKey, + keyframeId, + patch, + }), + ); + const command = + commands.length === 1 ? commands[0] : new BatchCommand(commands); + this.editor.command.execute({ command }); + } + upsertEffectParamKeyframe({ trackId, elementId, |
