Files
workinf_Blender_Wasm/web/protocol/animation-render-commands.ts
mes123456 7549b9a15c
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): switch to implementation-first capability wave
2026-08-29 01:22:03 +08:00

27 lines
1.8 KiB
TypeScript

import type { FCurveInterpolation } from "./web-engine";
import type { WebEngineEditCommand } from "./web-engine";
type AnimationCommand<T extends WebEngineEditCommand["type"]> = Extract<WebEngineEditCommand, { type: T }>;
/** Typed constructors for animation, constraint and render property edits. */
export const animationRenderCommands = Object.freeze({
insertKeyframe(objectId: string, frame: number, property: AnimationCommand<"insertObjectKeyframe">["property"], interpolation: FCurveInterpolation = "BEZIER"): AnimationCommand<"insertObjectKeyframe"> {
return { type: "insertObjectKeyframe", objectId, frame, property, interpolation };
},
deleteKeyframe(objectId: string, frame: number, property?: AnimationCommand<"deleteObjectKeyframe">["property"]): AnimationCommand<"deleteObjectKeyframe"> {
return { type: "deleteObjectKeyframe", objectId, frame, ...(property ? { property } : {}) };
},
setConstraint(objectId: string, constraintName: string, enabled: boolean, influence: number): AnimationCommand<"setConstraint"> {
return { type: "setConstraint", objectId, constraintName, enabled, influence };
},
setLightProperties(dataId: string, properties: AnimationCommand<"setLightProperties">["properties"]): AnimationCommand<"setLightProperties"> {
return { type: "setLightProperties", dataId, properties };
},
setCameraProperties(dataId: string, properties: AnimationCommand<"setCameraProperties">["properties"]): AnimationCommand<"setCameraProperties"> {
return { type: "setCameraProperties", dataId, properties };
},
setWorldProperties(dataId: string, properties: AnimationCommand<"setWorldProperties">["properties"]): AnimationCommand<"setWorldProperties"> {
return { type: "setWorldProperties", dataId, properties };
},
} satisfies Record<string, (...args: never[]) => WebEngineEditCommand>);