Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Shadow-root and pseudo-element CSS animations land about a frame off, differently each load

Aperta
#4,555 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend, web-dev

Direzione di ricerca

Start in packages/core/src/runtime/adapters/waapi.ts, focusing on ensureBaseline and how animation currentTime is captured. Reproduce the issue in headless Chrome with the supplied shadow-root and pseudo-element page, then call window.__player.seek(2) and inspect both computed transforms. Done means both consistently report the expected translateX(50px) across repeated loads.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happens

A CSS animation inside a shadow root, or on a ::before/::after pseudo-element, lands at a slightly different frame each time the page loads. Seeking to the same time gives a position that varies by about one frame between runs (0.4 to 1.25 px on a 4 s, 100 px slide), in Studio's preview and in renders.

The CSS adapter only drives an element's own animations, so these are left to the WAAPI adapter. The WAAPI adapter records a baseline for each animation the first time it sees it, including the animation's own currentTime at that moment (ensureBaseline in packages/core/src/runtime/adapters/waapi.ts). For a CSS animation that has been running since the page loaded, that value is however much wall-clock time passed before discover, so every later seek is offset by it.

Repro

Headless Chrome, the runtime built from main, window.__player.seek(2), then read the computed transform. Load the page several times.

<style>
@keyframes slide { from { transform: translateX(0) } to { transform: translateX(100px) } }
#el::before { content: "x"; display: inline-block; animation: slide 4s linear 1 both; }
</style>
<div data-composition-id="main" data-root="true" data-start="0" data-duration="10" data-width="640" data-height="360">
  <div id="el" class="clip" data-start="0" data-duration="10">el</div>
  <div id="host" class="clip" data-start="0" data-duration="10"></div>
</div>
<script>
  const sr = document.getElementById("host").attachShadow({ mode: "open" });
  sr.innerHTML = '<style>@keyframes slide { from { transform: translateX(0) } to { transform: translateX(100px) } } #in { animation: slide 4s linear 1 both; }</style><div id="in">in</div>';
</script>
<!-- then the runtime script -->

Read after seek(2):

  • getComputedStyle(document.getElementById("el"), "::before").transform
  • getComputedStyle(document.getElementById("host").shadowRoot.getElementById("in")).transform

Expected: translateX(50px) on every load.
Observed: about 50.4 to 51.25 px, different from run to run.

Notes

  • Animations on an element in the light DOM are driven by the CSS adapter from the clip's data-start and are exact.
  • Found while testing #4554. It is not caused by it; main behaves the same.
Lingua principale
TypeScript
Stelle
54.1k
Fork
4.9k
Merge medio
7h 18m
PR unite (30g)
784

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di heygen-com/hyperframes

Tutte le issue di heygen-com/hyperframes

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.