diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-02 15:08:21 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-02 15:08:21 +0100 |
| commit | 81e7a7fb32466633d38fa14bd5e14c2dca7bf658 (patch) | |
| tree | 60766b11ab738f855eaed04f77a875c22e5f0773 /apps/web/src/lib/animation/resolve.ts | |
| parent | 887d1795dd1662985400af5e02c4b7215c830a7d (diff) | |
| download | opencut-81e7a7fb32466633d38fa14bd5e14c2dca7bf658.tar.gz | |
feat: implement keyframe support for more properties at the core (no ui yet)
Diffstat (limited to 'apps/web/src/lib/animation/resolve.ts')
| -rw-r--r-- | apps/web/src/lib/animation/resolve.ts | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/web/src/lib/animation/resolve.ts b/apps/web/src/lib/animation/resolve.ts index 58f292b1..450ae983 100644 --- a/apps/web/src/lib/animation/resolve.ts +++ b/apps/web/src/lib/animation/resolve.ts @@ -1,6 +1,7 @@ -import type { ElementAnimations } from "@/types/animation"; +import type { AnimationPropertyPath, ElementAnimations } from "@/types/animation"; import type { Transform } from "@/types/timeline"; -import { getNumberChannelValueAtTime } from "./interpolation"; +import { getColorValueAtTime, getNumberChannelValueAtTime } from "./interpolation"; +import { getColorChannelForPath } from "./color-channel"; import { getNumberChannelForPath } from "./number-channel"; export function getElementLocalTime({ @@ -91,6 +92,24 @@ export function resolveOpacityAtTime({ }); } +export function resolveColorAtTime({ + baseColor, + animations, + propertyPath, + localTime, +}: { + baseColor: string; + animations: ElementAnimations | undefined; + propertyPath: AnimationPropertyPath; + localTime: number; +}): string { + return getColorValueAtTime({ + channel: getColorChannelForPath({ animations, propertyPath }), + time: Math.max(0, localTime), + fallbackValue: baseColor, + }); +} + export function resolveVolumeAtTime({ baseVolume, animations, |
