<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Layers on Kustom HQ</title><link>https://docs.kustom.rocks/tags/layers/</link><description>Recent content in Layers on Kustom HQ</description><generator>Hugo</generator><language>en</language><atom:link href="https://docs.kustom.rocks/tags/layers/index.xml" rel="self" type="application/rss+xml"/><item><title>Switch an image or layout if day or night (or by time)</title><link>https://docs.kustom.rocks/docs/recipes/layers/switch_layout/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.kustom.rocks/docs/recipes/layers/switch_layout/</guid><description>&lt;h1 id="switch-an-image-or-layout-if-day-or-night-or-by-time">Switch an image or layout if day or night (or by time)&lt;a class="anchor" href="#switch-an-image-or-layout-if-day-or-night-or-by-time">#&lt;/a>&lt;/h1>
&lt;p>Showing 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:&lt;/p>
&lt;ul>
&lt;li>Create an OverlapLayer that will contain both images&lt;/li>
&lt;li>Add an Image object to the layer just created and pick the night image&lt;/li>
&lt;li>Select the &amp;ldquo;Opacity&amp;rdquo; property and switch it to &amp;ldquo;formula&amp;rdquo; mode using the calculator icon&lt;/li>
&lt;li>Click it and enter following code &lt;code>$if(ai(isday), 0, 100)$&lt;/code> this will set opacity to 0 during the day and to 100 in the night&lt;/li>
&lt;li>Add another Image object to the layer and pick the day image&lt;/li>
&lt;li>Switch Opacity to formula as above and enter &lt;code>$if(ai(isday), 100, 0)$&lt;/code>&lt;/li>
&lt;li>Done!&lt;/li>
&lt;/ul>
&lt;p>This approach can be used also with text (using the color property) or with entire layers using a formula in the &amp;ldquo;visibility&amp;rdquo; property of the layer tab and returning either ALWAYS or NEVER.&lt;/p></description></item></channel></rss>