Skip to main content
e
2mo ago

Joysticks and Events

Maybe this is a feature request, but want to check here first.

I have a control panel with various controls and a "heart" monitor. My hope was that I could affect the heart monitor state machine (4 different timelines for 4 different speeds/colors selected via a number input) with the controls.

Each of the controls is a nested artboard controlled by a joystick (except the switches at the bottom) - sort of similar to this setup (https://rive.app/community/files/10884-20860-dial/). My original hope was to fire events at different states of the control that update a number variable in the code (a little more complex than that but that's the gist of the idea). Then use that variable to update the number input that controls the monitor. It seems like this is not possible? I tried firing events in the timelines for the controls, but that doesn't seem to be how joysticks controlled timelines work. I also tried creating hit zones that would fire events, but with my current setup, its possible to set a control to off/0 with small swipes in the same spot vs actually swiping through all the hit zones.

Am I missing something obvious or do I need to rethink my whole strategy?

6 replies
e
2mo ago

Hi emartins! If it's possible, can you share a screen capture or the file? just to have a better understanding of what you're trying

e
2mo ago

controlcenter.rev
27 MB

Here is the file, although I deleted all my attempts to fire events.

Here is an example of what I was thinking: A knob would fire events when it reaches the high, med, low, and off setting. In the code, I'd have a knob variable. When a med event, for example, is fired, I'd set that variable to 3. Then all the variables for all the controls would be added to a monitor variable. The monitor variable would then control the number input for the monitor.

e
2mo ago

I've never actually shared a file before, so I don't know if that's the right thing?

(edited) 2mo ago

Yes! this format works (.rev) I'm looking at it right now and I'll be back to you later, thanks!

2mo ago
[deleted]
2mo ago

Hey, took me a while to figure this one out, I had to ask a dev for help, he suggested these 2 ways of doing it. You can pick the one you think is best, they're both added to the project.
We created one event that's is gonna be reported by a pointer move with a listener that is a shape covering the whole artboard area.
The event is called "HeartRate" it has two properties one is a number called "Value" and the other is a string called "label". you can use one of them and should work, they're both keframed in the "Rotate" timeline. The number property is going from 100 to 0 interpolating all the number between them in the timeline.
And the string property has a keyframe in each moment with the names Hi, Med, Lo and Off.
The event is gonna be reported at all times the pointer moves enter the active area, but with one of these two properties you'll be able to filter them, does this makes any sense? hope this helps 🀞let me know if you have any further questions.
Here's the file and a quick video

controlcenter_edit.rev
27 MB


e
2mo ago

I never would have thought of this, thank you! I'll play around with it.