# Hide/Show layer every other minute?

I want to alternate between two different layers being either shown or hidden every other minute of the hour. So I would suppose if #Dm# is divisible by 2 it could either be true or false. I’m just not sure how to write the conditional expression to achieve this in the opacity field.

Something to the effect of:
layer 1: \$#Dm#/2==without a decimal?100:0\$
layer 2: \$#Dm#/2==with a decimal?100:0\$

Thanks for your help!

2 Likes

Welcome to the Community, I’m sure someone with some Math skills will be able to help you soon, but in the meantime…have fun creating

1 Like

Hi thanks for the welcome.

I’ve managed to do it and turns out to be simple. It works for me but not sure if it was done in the right way:

\$#Dm#/2==ceil(#Dm#/2)?100:0\$

This will return opacity value based on every other minute of the hour.

2 Likes

Awesome, well done

One of the ways to do this with a short formula is using the modulo expression: it returns the remainder of a division.
Layer1 opacity: \$#Dm#%2>0?0:100\$
Layer2 opacity: \$#Dm#%2==0?0:100\$

This example uses seconds instead, to illustrate the mechanism more quickly:

5 Likes

Thanks!

3 Likes

And yet another way to do it by odd or even minutes

Layer 1
Opacity: \$(#Dm#%2)=0?0:100\$
X or Y: \$(#Dm#%2)=0?999:160\$

Layer 2
Opacity: \$(#Dm#%2)=1?0:100\$
X or Y: \$(#Dm#%2)=1?999:160\$

2 Likes

I had to go back and edit/fix the labels in that example that I created in haste… I’ve been up all night binge watching the wild adventures of Uhtred of Bebbanburg on Netflix!

2 Likes