I use this expression in the foreground and background bindings for components when I want them to alternate colors, or flash, if you will, every second to indicate that something is happening. For instance, if I have a two state toggle button named btnScanning on my root container, and I have another component that I want to flash when btnScanning’s state is high, I would bind the component’s foreground color to this expression…
if ({Root Container.btnScanning.state},
if ((dateExtract(now(), 'second') & 1) ,
'black',
'white')
For the background color, you just reverse the black and white lines so they will contrast with the foreground color. Simple and sweet. You don’t need a timer elsewhere to provide your toggling effect. The only problem is that it only toggles at a one second rate. If you need faster or slower, you’ll need to use a timer or something else.