summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/animation/number-channel.ts
blob: 3e193131f430be8ffe203b71ce57fe180935dd85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import type {
	AnimationPropertyPath,
	ElementAnimations,
	NumberAnimationChannel,
} from "@/lib/animation/types";

export function getNumberChannelForPath({
	animations,
	propertyPath,
}: {
	animations: ElementAnimations | undefined;
	propertyPath: AnimationPropertyPath;
}): NumberAnimationChannel | undefined {
	const channel = animations?.channels[propertyPath];
	if (!channel || channel.valueKind !== "number") {
		return undefined;
	}

	return channel;
}