Switch an image or layout if day or night (or by time)
Switch an image or layout if day or night (or by time) #
howing an image based on a condition is pretty simple, to switch between one image and another based on day/night status you can do the following:
- Create an OverlapLayer that will contain both images
- Add an Image object to the layer just created and pick the night image
- Select the “Opacity” property and switch it to “formula” mode using the calculator icon
- Click it and enter following code
$if(ai(isday), 0, 100)$
this will set opacity to 0 during the day and to 100 in the night - Add another Image object to the layer and pick the day image
- Switch Opacity to fomula as above and enter
$if(ai(isday), 100, 0)$
- Done!
This approach can be used also with text (using the color property) or with entire layers using a formula in the “visibility” property of the layer tab and returning either ALWAYS or NEVER.
...