rive-app / rive-wasm

Wasm/JS runtime for Rive
MIT License
703 stars 51 forks source link

String dynamic values from the code #329

Closed ekokotov closed 1 year ago

ekokotov commented 1 year ago

Hello! I have a task to display a drum with different numerical values ​​in its sectors. These values ​​or numbers will be dynamic and coming from the code. I couldn't find in the documentation if it's possible to add a label or a placeholder to the animation where dynamic text (from the code) can be displayed. I'm using the WASM version. Thank you in advance!

zplata commented 1 year ago

Hi @ekokotov - right now, you'd have to layer a text element on top of the canvas. You could use the low-level APIs (@rive-app/canvas-advanced) to grab the position of a node from the draw hierarchy to know where to absolutely position your text element on top.

However, we do have a text feature coming pretty soon here that will allow you to dynamically change text values at runtime much easier (and you can just use the high-level @rive-app/canvas runtime for this). This might be of more interest in your use case

ekokotov commented 1 year ago

Thank you a lot for new features!