diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-25 16:47:22 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:48:22 +0200 |
| commit | 8db3bead13441a5882d8689dfc6a9f09c82375d9 (patch) | |
| tree | e9d0cafa93904ffcbec3188c37961bcc16c6422d /apps/web/src/lib/animation/keyframe-query.ts | |
| parent | 39ea298a9ccba3104c549c0ca079c231981811f5 (diff) | |
| download | opencut-8db3bead13441a5882d8689dfc6a9f09c82375d9.tar.gz | |
feat: masks, properties refactor, shaders, storage migrations, and more
Diffstat (limited to 'apps/web/src/lib/animation/keyframe-query.ts')
| -rw-r--r-- | apps/web/src/lib/animation/keyframe-query.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/apps/web/src/lib/animation/keyframe-query.ts b/apps/web/src/lib/animation/keyframe-query.ts index 6626e3e8..753e31d0 100644 --- a/apps/web/src/lib/animation/keyframe-query.ts +++ b/apps/web/src/lib/animation/keyframe-query.ts @@ -1,9 +1,10 @@ import { TIME_EPSILON_SECONDS } from "@/constants/animation-constants"; import type { - AnimationPropertyPath, + AnimationPath, ElementAnimations, ElementKeyframe, -} from "@/types/animation"; +} from "@/lib/animation/types"; +import { isAnimationPath } from "./target-resolver"; export function getElementKeyframes({ animations, @@ -16,12 +17,16 @@ export function getElementKeyframes({ return Object.entries(animations.channels).flatMap( ([propertyPath, channel]) => { - if (!channel || channel.keyframes.length === 0) { + if ( + !channel || + channel.keyframes.length === 0 || + !isAnimationPath({ propertyPath }) + ) { return []; } return channel.keyframes.map((keyframe) => ({ - propertyPath: propertyPath as AnimationPropertyPath, + propertyPath, id: keyframe.id, time: keyframe.time, value: keyframe.value, @@ -36,7 +41,7 @@ export function hasKeyframesForPath({ propertyPath, }: { animations: ElementAnimations | undefined; - propertyPath: AnimationPropertyPath; + propertyPath: AnimationPath; }): boolean { const channel = animations?.channels[propertyPath]; return Boolean(channel && channel.keyframes.length > 0); @@ -48,7 +53,7 @@ export function getKeyframeAtTime({ time, }: { animations: ElementAnimations | undefined; - propertyPath: AnimationPropertyPath; + propertyPath: AnimationPath; time: number; }): ElementKeyframe | null { const channel = animations?.channels[propertyPath]; |
