Change Gradient based on Timer?

Hi, I’m trying to change a Gradient Color based on timer and While conditionals, but it wont work.

It will always take it as False even though debug_log shows the value change from False to True.

Can someone point out what am I doing wrong and how can I fix it?

Thanks in advance.

var Observable = require("FuseJS/Observable");

var Timer = require("FuseJS/Timer");

var isSomethingEnabled = Observable(false);


Timer.create(function() {
    debug_log(isSomethingEnabled.value);
        isSomethingEnabled = Observable(true);
}, 5000, true);
module.exports = {
Timer: Timer,
isSomethingEnabled: isSomethingEnabled,
Observable: Observable
}
</JavaScript>

<WhileFalse Value="{isSomethingEnabled}">
<Change GradientColor1.Color="#fff" />
</WhileFalse>
<WhileTrue Value="{isSomethingEnabled}">
<Change GradientColor1.Color="Red" />
</WhileTrue>

Try to remove the observable in the function, because the only thing that should be observable is the variable isSomething be USSR that’s what you’re trying to see in the UI, If you were trying to see from the function then yeah, try just removing the observable; idk if it’ll work or not but it may

You need to change

isSomethingEnabled = Observable(true);

to

isSomethingEnabled.value = true;

And if you want it to constantly change between true and false then you need to change it to:

isSomethingEnabled.value = !isSomethingEnabled.value;