Kodi Community Forum
Trigger a fade animation when the label or textbox contents change? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: Trigger a fade animation when the label or textbox contents change? (/showthread.php?tid=208567)



Trigger a fade animation when the label or textbox contents change? - woodside - 2014-11-11

Is there a way to trigger a fade in animation on a label or textbox control when the contents of the label or a textbox change?
I cannot for the life of me get a fade animation to work when the contents of the label change no matter what I try. Thanks.

[EDIT] I can do it if I set a visibilty condition on the label control based on the contents of a Skin.String and then do this...


PHP Code:
<visible>Skin.String(labelanimate,on)</visible>
<
animation effect="fade" start="0" end="100" time="400" condition="Skin.String(labelanimate,on)">Conditional</animation

and put this in a fake button control that I use to control a dynamic list...
PHP Code:
<ondown>Skin.SetString(labelanimate,off)</ondown>
... Do 
some stuff...
<
ondownAlarmClock(labelanimate,Skin.SetString(labelanimate,on),00:01,silent)</ondown

Kind of a weird way of doing it but it works... I just don't like it because I can only set the AlarmClock for seconds and I don't want it to wait that long before it fades back in. Maybe for a half a second at the most.


RE: Trigger a fade animation when the label or textbox contents change? - MassIV - 2014-11-12

Skin.String() returns an info label and doesn't take arguments.

Look at StringCompare(info,string) or SubString(info,string) for comparing values.

If you just need a true/false you can use Skin.HasSetting(setting) and !Skin.HasSetting(setting). Which you can toggle with Skin.ToggleSetting(setting).

http://kodi.wiki/view/List_of_boolean_conditions


RE: Trigger a fade animation when the label or textbox contents change? - woodside - 2014-11-12

(2014-11-12, 00:35)MassIV Wrote: Skin.String() returns an info label and doesn't take arguments.

Look at StringCompare(info,string) or SubString(info,string) for comparing values.

If you just need a true/false you can use Skin.HasSetting(setting) and !Skin.HasSetting(setting). Which you can toggle with Skin.ToggleSetting(setting).

http://kodi.wiki/view/List_of_boolean_conditions
Hi thanks for your reply. Logic seems to me this should work but it doesn't.
I have a label control with the visibility set as such...

PHP Code:
<visible>Skin.HasSetting(test)</visible>
<
animation effect="fade" start="0" end="100" time="400">Visible</animation

I have a fake button to control a dynamic list that I have multiple StringCompare()'s to check and change the contents of the list.
So If I use the following in my button it seems to me it should trigger the visible animation but it doesn't.
PHP Code:
<ondown>Skin.Reset(test)</ondown>
<
ondown condition="StringCompare(this,that)">do something</ondown>
<
ondown condition="StringCompare(this,that)">do something</ondown>
<
ondown condition="StringCompare(this,that)">do something</ondown>
<
ondown>Skin.SetBool(test)</ondown

Is it that it is setting and resetting the SkinString(test) setting so fast that Kodi just doesn't have time to register the change?


RE: Trigger a fade animation when the label or textbox contents change? - MassIV - 2014-11-12

I believe a button like that only takes onfocus. And you can use alarm for a delay, but 1 sec is as fast as it goes.

<onfocus>Skin.Reset(test)</onfocus>
<onfocus>AlarmClock(ShowText,Skin.SetBool(test),00:01,silent)</onfocus>


RE: Trigger a fade animation when the label or textbox contents change? - woodside - 2014-11-12

(2014-11-12, 14:34)MassIV Wrote: I believe a button like that only takes onfocus. And you can use alarm for a delay, but 1 sec is as fast as it goes.

<onfocus>Skin.Reset(test)</onfocus>
<onfocus>AlarmClock(ShowText,Skin.SetBool(test),00:01,silent)</onfocus>

Yeah, that is what I was using (AlarmClock) but slightly in a different way with an <ondown>. 1 second is not that long of a time period to wait for a label to show I suppose. I wish you cold set the alarm with fractions of a second 00:005 or something like that, then that would be perfect. I'll either live with the 1 second delay or figure something else out. Thanks for your time and response. I really appreciate the help you and others give a wannabe like me. Wink


RE: Trigger a fade animation when the label or textbox contents change? - toolpunk - 2014-11-12

Try <onfocus>AlarmClock(ShowText,Skin.SetBool(test),00:00,silent)</onfocus> and add a 500ms delay to the animation. Not sure if AlarmClock allows this though...


RE: Trigger a fade animation when the label or textbox contents change? - woodside - 2014-11-12

(2014-11-12, 16:02)toolpunk Wrote: Try <onfocus>AlarmClock(ShowText,Skin.SetBool(test),00:00,silent)</onfocus> and add a 500ms delay to the animation. Not sure if AlarmClock allows this though...

Dang Bro!!!... you da man!... works perfect. Thanks!Big Grin