I'm would say I know only a little bit on Javascript but enough to add simple interactivity to apps / websites. However, recently I came across an app that uses reactive javascript instead of the normal javascript that I'm used to. (not sure what the 'Normal' javascript is called.)
Conventional If-Else statements do not seem to work in reactive javascript so I was wondering if anyone can help me figure out what this line would be in reactive javascript? It would be really helpful if anyone can teach me how you do it / direct me to a source where I can learn more.
const car = Scene.root.find('Collider');
const carMaterial = Materials.get('ColliderMat');
const carMaterial2 = Materials.get('ColliderMat2');
var loopCountNum = Patches.getScalarValue('loopCount');
if (loopCountNum > = 0)
{
car.material = carMaterial;
}
else if(loopCountNum >= 10)
{
car.material = carMaterial2;
}
The idea here is that when the loopCount reaches a certain range, the car material changes. I don't know how it works in Reactive Javascript and has been struggling with this for awhile now. Any help would be greatly appreciated.
(Loop Count is derived from another function and it is working properly)