Solved Animation Fade Out After Delay
#1
Two questions for my Home.xml:
  1. I am looking to have one label appear when the home screen is first presented, then fade out after a delay. Then have a second label fade in where the first label was.
  2. Only have that first label show when Kodi is first opened. The second label should be shown any time Home.xml is presented.
Here is my code:
xml:
            <control type="label">
                <description>Kodi label</description>
                <right>130</right>
                <top>45</top>
                <width>300</width>
                <height>15</height>
                <align>right</align>
                <aligny>center</aligny>
                <font>font30_light</font>
                <textcolor>white</textcolor>
                <label>Kodi Media Center</label>
                <animation effect="fade" start="100" end="0" time="500" delay="5000">WindowOpen</animation>
                <animation effect="fade" time="200">WindowClose</animation>
                <visible>true</visible>
            </control>
            <control type="label">
                <description>Time label</description>
                <right>130</right>
                <top>45</top>
                <width>300</width>
                <height>15</height>
                <align>right</align>
                <aligny>center</aligny>
                <font>font30_light</font>
                <textcolor>white</textcolor>
                <label>$INFO[System.Time]</label>
                <animation effect="fade" delay="5000" start="0" end="100" time="500">WindowOpen</animation>
                <animation effect="fade" time="200">WindowClose</animation>
                <visible>true</visible>
            </control>

The "Time label" (2nd label) fades in as expected but the "Kodi label" (1st label) is the problem. It is not visible until the delay="5000" is done. Nothing is there at the start, then it appears after the 5000ms and then fades out over the 500ms. How do I get it to be visible when the Window opens and fade out after the 5000ms?

Also, after Kodi is opened and the above animation is complete, how do I get the "Time label" to always be visible and the "Kodi label" to not show? Right now it happens every time I go back to Home.xml. If I go into a library, and go back to the home screen, the animation happens again and I only want it to happen once after Kodi is opened.
Reply
#2
Try something like this -

xml:
<animation type="Conditional" condition="Window.Previous(startup)">
<effect type="fade" start="100" end="100" time="0"/>
<effect type="fade" start="100" end="0" time="500" delay="5000"/>
</animation>
Reply
#3
(2023-11-23, 00:05)Hitcher Wrote: Try something like this -

xml:
<animation type="Conditional" condition="Window.Previous(startup)">
<effect type="fade" start="100" end="100" time="0"/>
<effect type="fade" start="100" end="0" time="500" delay="5000"/>
</animation>

Once again, a big thanks to you @Hitcher. That got me most of the way there. There was some issues with having the time label there when going back to home and the Kodi label being there when leaving Home.xml so I added another element to take care of it.

This is what I ultimately ended up with:
xml:
            <control type="group">
                <description>Kodi/Time label after startup</description>
                <visible>Window.Previous(startup)</visible>
                <control type="label">
                    <description>Kodi label</description>
                    <right>130</right>
                    <top>45</top>
                    <width>300</width>
                    <height>15</height>
                    <align>right</align>
                    <aligny>center</aligny>
                    <font>font30_light</font>
                    <textcolor>white</textcolor>
                    <label>Kodi Media Center</label>
                    <animation  type="TYPE" condition="Window.Previous(startup)">
                        <effect type="fade" start="100" end="100" time="0"/>
                        <effect type="fade" start="100" end="0" time="500" delay="4500"/>
                    </animation>
                    <animation effect="fade" start="0" end="0" time="0">WindowClose</animation>
                </control>
                <control type="label">
                    <description>Time label</description>
                    <right>130</right>
                    <top>45</top>
                    <width>300</width>
                    <height>15</height>
                    <align>right</align>
                    <aligny>center</aligny>
                    <font>font30_light</font>
                    <textcolor>white</textcolor>
                    <label>$INFO[System.Time]</label>
                    <animation effect="fade" delay="5000" start="0" end="100" time="500">WindowOpen</animation>
                    <animation effect="fade" time="200">WindowClose</animation>
                </control>
            </control>
            <control type="label">
                <description>Time label</description>
                <right>130</right>
                <top>45</top>
                <width>300</width>
                <height>15</height>
                <align>right</align>
                <aligny>center</aligny>
                <font>font30_light</font>
                <textcolor>white</textcolor>
                <label>$INFO[System.Time]</label>
                <include>Window_OpenClose_Animation</include>
                <visible>!Window.Previous(startup)</visible>
            </control>
Reply
#4
I think this should do the same with less code -

xml:
<control type="group">
<description>Kodi/Time label after startup</description>
<control type="label">
<description>Kodi label</description>
<right>130</right>
<top>45</top>
<width>300</width>
<height>15</height>
<align>right</align>
<aligny>center</aligny>
<font>font30_light</font>
<textcolor>white</textcolor>
<label>Kodi Media Center</label>
<animation type="WindowOpen" condition="Window.Previous(startup)">
<effect type="fade" start="100" end="100" time="0"/>
<effect type="fade" start="100" end="0" time="500" delay="4500"/>
</animation>
<animation type="WindowOpen" condition="!Window.Previous(startup)">
<effect type="fade" start="0" end="0" time="0"/>
</animation>
<animation effect="fade" start="0" end="0" time="0">WindowClose</animation>
</control>
<control type="label">
<description>Time label</description>
<right>130</right>
<top>45</top>
<width>300</width>
<height>15</height>
<align>right</align>
<aligny>center</aligny>
<font>font30_light</font>
<textcolor>white</textcolor>
<label>$INFO[System.Time]</label>
<animation type="WindowOpen" condition="Window.Previous(startup)">
<effect type="fade" start="0" end="100" time="500" delay="5000"/>
</animation>
<animation type="WindowOpen" condition="!Window.Previous(startup)">
<effect type="fade" start="0" end="100" time="500"/>
</animation>
<animation effect="fade" start="0" end="0" time="0">WindowClose</animation>
</control>
Reply
#5
Yep. That's a lot better. Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
Animation Fade Out After Delay0