Kodi Community Forum

Full Version: How to make effect WindowOpen slide effect when pressing a key?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I'm trying to make an animation like this: when I press a key, fire up the WindowOpen animation defined for the whole window.
I tried this to define a conditional animation for the window:
<animation effect="slide" time="300" start="1280,0" condition="Control.HasFocus(500)">Conditional</animation>

Then, I created an invisible button (with Id 500) which get focus when I press the key. I did that with setFocusId(500) somewhere in the code.

However, this doesn't work. Any idea on how to do this?

Thanks
Did you put the animation at the same place where the WindowOpen animation is? The animation should work, I don't see anything why it shouldn't... did you add allowhiddenfocus = "true" to the button's visible condition?
I'm not sure what you mean, but I have this at the beginning of my window xml:
<window id="4007">
<animation effect="slide" time="300" start="1280,0" end="0,0" condition="Control.HasFocus(500)">conditional</animation>

Is this ok?

Thanks
Yes, should be ok. If your control is hidden, you have to add allowhiddenfocus to the button's visible condition, maybe that's your problem:

Code:
<control type="button">
   ...
   <visible allowhiddenfocus="true">...</visible>
</control>

If you added that already, I have no idea why it doesn't work...
Unfortunately, this still doesn't work...it seems that the control doesn't get immediate focus after setFocusId(). If I do setFocusId(500) and then getFocusId(), the result is other id...A few actions after, then seems ok... But I guess this is not the problem...
Have someone tried this?

Thanks
We really need your code to test it out.
I think I understand now...You can only assign WindowOpen or WindowClose animations to Windows. It is not possible to add Conditional or any other type of animations to Windows, only to Controls.
What I did was to create a group with all the controls and put the Conditional animation in the group control. Then it worked! Smile

Thanks