Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

484 B
Raw Blame
import { collectElementPatches, patchElements } from "./elementPatchQueue";
import { usePlayerStore } from "./playerStore";

/** `updateElement` calls inside `run` land as one store update: one pass over the list, one notification. */
export function batchElementUpdates(run: () => void): void {
  const patches = collectElementPatches(run);
  if (!patches || patches.size === 0) return;
  usePlayerStore.setState((state) => ({ elements: patchElements(state.elements, patches) }));
}