From 68117d5b040bd63699c1932d0eb8d23b3355e284 Mon Sep 17 00:00:00 2001 From: konstantin-paulus Date: Thu, 23 Jul 2026 23:31:14 +0200 Subject: [PATCH] Enhance image encoder to manage timeline clocks and local time updates Updated the image encoder to track entities with timeline clocks, ensuring that local time is consistently updated for both the main stage and clock entities. This change improves synchronization during playback and enhances the overall functionality of the image encoding process. --- .../src/components/engine/encode/image-encoder.ts | 13 ++++++++++++- reference/jsx/html-paint.md | 11 ++--------- reference/jsx/timing.md | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/engine/encode/image-encoder.ts b/apps/web/src/components/engine/encode/image-encoder.ts index 5d29493..4e78815 100644 --- a/apps/web/src/components/engine/encode/image-encoder.ts +++ b/apps/web/src/components/engine/encode/image-encoder.ts @@ -106,10 +106,21 @@ export async function createImageEncoder(sourceWorld: EngineWorld, config: Image // computed start is 0 unless it carries a Trim, whose start offsets it. const startFrame = c.Computed.start[rootEid] ?? 0; + // Entities in the clone that own a timeline clock + const clockEids = clonedEids.filter(eid => hasComponent(world, eid, c.Playback)); + const seek = (frame: number) => { const stageFrame = startFrame + frame; + const stageSeconds = framesToSeconds(stageFrame, world.frameRate); c.Computed.localTime[stageEid] = stageFrame; - c.Computed.localTimeInSeconds[stageEid] = framesToSeconds(stageFrame, world.frameRate); + c.Computed.localTimeInSeconds[stageEid] = stageSeconds; + + for (const eid of clockEids) { + c.Computed.localTime[eid] = stageFrame; + c.Computed.localTimeInSeconds[eid] = stageSeconds; + c.Playback.playing[eid] = 1; + } + world.timestamp.delta = 1000 / world.frameRate; world.timestamp.now += world.timestamp.delta; diff --git a/reference/jsx/html-paint.md b/reference/jsx/html-paint.md index 8462000..a913a60 100644 --- a/reference/jsx/html-paint.md +++ b/reference/jsx/html-paint.md @@ -3,7 +3,7 @@ An element whose children are **real HTML**: the browser lays them out at the element's box size and the result is drawn into the box via the [html-in-canvas](https://github.com/WICG/html-in-canvas) API. `dapi` always drives the Diffusion Studio Electron app, which ships with this API enabled, so `` is always available — reach for it liberally. It is the recommended way to build motion graphics, overlays, and any UI-heavy content: styled cards, tables, code blocks, flex/grid layouts — anything painful to assemble from `` and ``. ```tsx - +
01 Introduction @@ -21,14 +21,6 @@ An element whose children are **real HTML**: the browser lays them out at the el ``` -A [``](./scene.md) is a filled visual element too, so an `` can sit directly on it: the paint fills the whole composition box and the scene becomes a **pure HTML scene**, laid out entirely with real HTML and CSS: - -```tsx - - - -``` - ## Reactivity @@ -65,3 +57,4 @@ The compiled module is persisted with the document: on reload, export, and `dapi - Cross-origin subresources (e.g. remote images) are excluded from the painted output by the browser's read-back rules; use local assets. - `