Server side instantiation with no canvas?
SupremeTechnopriest opened this issue · 2 comments
I did some combing through the code and it doesn't seem to be possible to load an actor server side. Everything depends on Graphics and a canvas of some kind. I want to be able to instantiate the runtime server side without a canvas. Then I can trigger animations and get the bones x, y and rotation and send to my clients. I have achieved this pretty easily using spine-core, but we like the actual animation tooling better in Rive. Am I missing something, or is this a fork and a massive rewrite?
Thanks!
Rive 1 (Flare) didn't have support for this scenario. Our JS runtime is pretty tightly coupled with the rendering layer. It's possible to stub out the renderer but it would need to be done in a fork with a meaty set of changes.
Our new version, Rive 2, does support a headless (or null) renderer. I'd encourage you to sign up for our beta and take a look at the new runtimes here:
Repo with the Rive 2 C++ runtime
https://github.com/rive-app/rive-cpp
Repo that has code for binding the C++ runtime to WASM and exposing functionality to JS. You could modify this code to implement an empty renderer by writing your own version of this file: https://github.com/rive-app/rive-wasm/blob/master/js/renderer.js
Thanks! I actually stumbled upon the beta version and got it working in node with minimal polyfilling. I just needed to stub document.createElementNS
and Path2D
. Then I was able to to load actors via node. We submitted some feedback, but we are just waiting on the ability to access Bone info directly and we can switch over from Spine to Rive. Looking forward to it! I'll close this issue.