Skip to content

Compositions lack requestAnimationFrame and Image #56

Closed

Description

@shinyobjectz

From #13's run of snapcn's free components through raea: two browser globals that components use aren't defined in a composition.

  • requestAnimationFrame: pulsing-border, through @paper-design/shaders-react, throws "Can't find variable: requestAnimationFrame".
  • Image: capture-reveal preloads with new Image() and throws "Can't find variable: Image".

An app page (@raea/ui) has both. In a render, requestAnimationFrame could run its callbacks once per frame step, and new Image() could load from the media folder, as <img> does.

Activity

  1. shinyobjectz commented on Nov 12, 2026

    @shinyobjectz
    OwnerAuthor

    Fixed on main in 645b085; it ships in 0.1.3. Compositions now have these where the runtime has none:

    • requestAnimationFrame / cancelAnimationFrame: a callback runs once, at the next frame the composition draws, and gets that frame's time (frame * 1000 / fps ms). A frame drawn again (--at, a resumed render) gets the same calls.
    • Image: setting src fires load (and onload) on the next microtask, so a preload like capture-reveal's resolves. It reports no pixel size (naturalWidth stays 0). <img> still draws the file itself.

    pulsing-border will still stop at @paper-design/shaders-react's WebGL2, which a composition doesn't have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions