FACER Community

Cycle backgrounds


I used VAR Toggle to choose between 2 backgrounds.
But I have 5.
Is it possible to cycle through them with VAR Increment?
Is possible to do that with the hands etc too, so that I kinda have 5 different faces to pick.
If yes, how? :face_with_peeking_eye:


1 Like

Yes! You can use the modulo expression % to do that.

If you only have 5 faces total, and you’re using VAR_1, then each face’s opacity can be set in the manner below, to either show it or to hide it. You will need to increment VAR_1 and keep incrementing (in your face above you’re toggling it).

  • Face 1 opacity: $(#VAR_1#%5)==0?100:0$
  • Face 2 opacity: $(#VAR_1#%5)==1?100:0$
  • Face 3 opacity: $(#VAR_1#%5)==2?100:0$
  • Face 4 opacity: $(#VAR_1#%5)==3?100:0$
  • Face 5 opacity: $(#VAR_1#%5)==4?100:0$

Continuing to increment VAR_1 will keep it counting up, but using the modulo expression as above, its result will keep cycling from 0 to 4 over and over. If you had more faces, then the modulo calculation would be (#VAR_1#%X) where X is the total number of faces, and the equality test would be from 0 to X-1.

Now, another way is to set each face’s X location, to either have it in the middle of the face at 160 or to hide it by moving it off the face at -200 in this manner:

  • Face 1 X location: $(#VAR_1#%5)==0?160:-200$
  • Face 2 X location: $(#VAR_1#%5)==1?160:-200$
  • Face 3 X location: $(#VAR_1#%5)==2?160:-200$
  • Face 4 X location: $(#VAR_1#%5)==3?160:-200$
  • Face 5 X location: $(#VAR_1#%5)==4?160:-200$

If you’re doing something else with an element’s opacity, then the second method is obviously the way to go.

Play with modulo in an Excel spreadsheet to see it visually. Here’s a snapshot of using modulo with 4 different values of 2, 3, 4, and 5. You can see how it controls the cycles:


Thanks so much! It works fine.
We keep on learning.

1 Like

Looks like we have a Mind Reader. I was thinking of a face that change for another every srcond. Might have it done by Christmas. :slightly_smiling_face::+1:


1 Like