Hi,
I’m using a Rive animation on my project. I added it with a script in a “custom html” component, it works perfectly.
I now need to retrieve in my script the content of several variables in my project.
Does anyone know how to do this?
Thank’s
Hi,
I’m using a Rive animation on my project. I added it with a script in a “custom html” component, it works perfectly.
I now need to retrieve in my script the content of several variables in my project.
Does anyone know how to do this?
Thank’s
yes, you can access weweb variables in JS using wwLib.wwVariable.getValue. I made a video about these integrations that you might find handy:
Thank you very much @raydeck !
I’m getting there with a simple variable (text). Do you know if it’s possible to retrieve objects or collections?
Hi @Tang
If you select a variable or collection in a binding and toggle to JavaScript
, you’ll be able to see its reference.
Here’s a video of what I mean: Refer to a variable — Tella
Does that make sense? Does it help with your use case?
You can retrieve any kind of variable - not just primitives like text or numbers.
In the video I show how one can use the devtools console to explore the weweb javascript API a bit - i find this really accelerates the learning so you can see what things look like without trying to make all the functionality work at the same time.
Similarly, @Joyce 's point about toggling between formula and JS mode gives you more transparency. The more you see, the more you know. And the more you know, the more rooted your confidence in what you do next!
We work on these kinds of hard problems daily in State Change office hours. We have a number of members working on advanced integrations in weweb, and we work through the sticky parts there in a few minutes during our daily live zooms rather than back and forth over days.