Skip to content

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

@a3mitskevich

Description

@a3mitskevich

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions