How to change object color based on slider position?

Hi, I'm trying to solve a problem by using advanced variables based on the examples in https://support.proto.io/hc/en-us/articles/220036547-Variable

I'm trying to change the background color on an object based on the position value of a slider, triggered by Slider drag. Example below:

I've managed to make the number change by putting the slider value in a variable and updating the text field by callback, but I can't do the same for the oval background color.

I've tried using the ({var1} < 50) ? -1 : (({var1} > 50 ) ? 1 : 50) formula to solve this by putting it in another variable and doing another callback, but it always gets stuck on one color. Example below:

({slider_position} < 50) ? "#eb3c00" : (({slider_position} > 50 ) ? "#4caf50" : "#ffb900")

I had to put it inside a variable and use Read from variable sice Custom Value for colors is a color picker and not an input field.

I'm probably not using this as intended but I can't find any other solutions for this problem, if there is another way to do this I'd like to know how?


Please sign in to leave a comment.