How to create a flashing component in Vision

I want to create a flash label in vision project. The background color keeps changing from red and white colors periodically.

Anyone can share some ideas how I can make this happen? Thanks!

Generally if I need to do this, I put a binding on background colour similar to this (This is a 1 second flash). Make sure background fill is enabled.

if(
	{TagToActiveFlashing},
	case(
		getSecond(now()) % 2,//Toggles every second
		0, color(255,0,0), //Red
		1, color(255,255,255), //White
		color(0,0,0) //Black if neither 0 or 1
		),
	color(123,123,123) // color if not flashing
)
3 Likes

Use style customizer.

6 Likes

Thanks! this is a good method, I have tried your method and it is workable.

Helpful Tips! Thank you.

This was such a stupid simple solution. I just used the Visible as my Driving Property for Fill Paint and then set an animation to get the flash result I wanted. Thanks much!

The correct answer is a style customizer based on a custom property (INT) with your binding that determines when it should flash. The customizer is a much simpler solution than a complicated color binding.

As an aside, non synchronized flashing looks bad in my opinion, so if you have more things that may be flashing at the same interval, i would create a vision client tag with an expression something like toMillis(now(500)) % 1000 < 500
You can use the client tag expression to alternate colors and it will synchronize the flashing every place you use it.