How to animate simple alternating color loop?

Hi, I am trying to do something very simple: have an object turn red, blue, red, blue, forever like a police light. It doesn’t have to glow. I am using Blender 3.x and 4.x.

I’ve googled the heck out of this and nothing works! How do you do this?

Thanks!

welcome back, congrats on your long slumber

Here’s how to alternate between 2 colors, switching every single frame:

9 Likes

Wow that works perfectly, thank you!

1 Like

BTW is there any way to see the #frame word after enter it? I’m pretty sure that 2 years from now I won’t remember what I put in there! :grinning:

You can add a frame around it and label the frame (like I did on the screenshot)

You could rename the value node to #frame to remind yourself

Or you could hold the ‘d’ key and draw notes directly into the node editor.

1 Like

The ‘#frame’ just creates a Driver in that property, and if you go to the Drivers Editor, and look down the material’s nodetree, you’ll find that driver, and you can see the ‘frame’ word in the expression box.

Another alternative from the solution from @SterlingRoth, is to use the Attribute node, with Type set to ‘View_Layer’, and the attribute to ‘frame_current’ (the API name). The result is the same, but with this, you’re accessing the property from the scene and not from a driver; and you can see the name of the variable in the material nodetree.

1 Like