rive-app / rive-app/rive-wasm

Feature Request: Decouple getRuntime to Allow Dynamic Runtime Switching and Improve Performance

Open
#412 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
968
Forks
85
Avg merge
15h 1m
Merged PRs (30d)
1

Description

First of all, thank you for the fantastic Rive product! It's incredibly powerful and enables amazing animations.

I've encountered a limitation when trying to dynamically switch between rendering runtimes (WebGL2, WebGL, Canvas) within the same application. Currently, the wrapper implementations, while very consistent, don't allow for switching the runtime on-the-fly for a specific animation without re-initializing and re-downloading the entire WASM wrapper code. This hurts performance and limits flexibility.

I propose decoupling the getRuntime method or the runtime selection logic into a separate module. The ideal solution would allow passing a runtime type (e.g., webgl2, webgl, canvas) as a parameter during the wrapper's initialization.

This would enable:

  • Dynamic runtime selection per animation instance based on its complexity or the current device capabilities.
  • Avoiding the performance cost of re-downloading and re-initializing the JavaScript wrapper code when a different runtime is needed.
  • Greater flexibility for building complex applications that integrate multiple types of animations.

The current alternative is to create multiple instances of the entire Rive WASM module for each required runtime, which is inefficient for bundle size and application load time.

Additional context:
This change would significantly improve the developer experience by making it easier to build adaptive and high-performance web applications that leverage Rive animations to their full potential.

Thank you for considering this feature!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating getRuntime and the wrapper initialization path mentioned in the issue, then trace how runtime selection handles WebGL2, WebGL, and Canvas. Compare the current per-runtime module initialization and identify what would be needed to pass a runtime type without re-downloading or re-initializing the wrapper. Done means runtime choice can vary per animation instance while preserving existing initialization behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, wasm
Domain
frontend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.