Kodi Community Forum

Full Version: Animation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Trying to answer a question:
http://forum.xbmc.org/showthread.php?tid...pid1420655

I suggested he try the skin.string to trigger the submenu animation instead of the property. But it looks like he'll need an example.
So I tried to make a test. And while it "works" i can't see why my submenu slide animation will only trigger the first time:
http://pastebin.com/98FEf6Kd

Code:
<animation effect="slide" start="-300,0" end="0,0" time="350" condition="!IsEmpty(skin.string(SubMenu2))">Conditional</animation>

Also tried making the condition depend on a normal button's visibility. While the button behaves as it should, the animation just doesn't seem to read the condition more then once, per window load.
Le bump.

I'd still like to know why the skin string gets read only once.
This should work:

PHP Code:
<onclick condition="IsEmpty(Skin.String(SubMenu2))">Skin.SetString(SubMenu2,open)</onclick>
<
onclick condition="!IsEmpty(Skin.String(SubMenu2))">Skin.Reset(SubMenu2)</onclick>
<
onclick condition="IsEmpty(Skin.String(SubMenu2))">Skin.SetString(SubMenu2,open)</onclick
While that is a nicer way to reset a string. This doesn't solve it. As the string was already working. And the submenu does open and close with it, always. The problem is animating this 'opening'. You'd think that the string used to show/hide the menu could also be used to animate it.
But it works only once for the animation.

Talking about that slide animation on line 48.
I think the problem is if you don't use 3 onclicks, you set the string to open and then the next time it won't be resetted because you clear it and then in the next onclick is set to open again... you have to play a little bit, maybe it's the other way around

PHP Code:
<onclick condition="!IsEmpty(Skin.String(SubMenu2))">Skin.Reset(SubMenu2)</onclick>
<
onclick condition="IsEmpty(Skin.String(SubMenu2))">Skin.SetString(SubMenu2,open)</onclick>
<
onclick condition="!IsEmpty(Skin.String(SubMenu2))">Skin.Reset(SubMenu2)</onclick

The animation looks fine but the onclicks are the problem... try to show the string with a label and you'll see that it changes only 1 time.
The problem is that skin strings are not dynamic if you use them in a (list) container. This was done for performance reasons iirc. You'll need to move the code out of the container for this to work.
Sadly that wasn't it either Black.

Big_Noid what did you mean by moving the code out of the container?
I tried making a button (outside the container) with visibility based on !IsEmpty(skin.string(SubMenu2))
Which works good, as expected. But the animation has the same issue when based on Control.IsVisible(ID)
Sorry it took me so long. Problem here is that we don't track status of animation condition when submenu items are not visible in container. I bet this can be workaround to make it work with some skinning magic, but I'd rather fix it in core. I think there are two possible solutions:
  • when we hide item from container, we could force reset animations (meaning animation would restart when item become visible, even if animation condition didn't change - not really the case here as both visible condition and animation condition are linked)
  • keep track of animation conditions when item is not visible (this seems more inline with what we do normally I guess)
Visible condition and animation condition are linked here, but don't necessarily happen at the same time.
In a long list of submenu items (that is longer then the list control itself) the animation gets triggered when they become visible (on scrolling down, one by one) while the condition for the animation has been true all along.

I can't say what is best though. But i do have a bigger menu example for you to work with if you want it.
If you have example/sample around than sure, You can paste it here.

I'd want to make behaviour consistent with what we already have. I tested on controls outside of container and there animation doesn't wait for control to become visible (it starts as soon as condition is met even if control is hidden). It's definitely possible to use "control.isvisible(x)" to wait with animation for control to become visible. I start to think this is good approach to deal with container items aswell - add ListItem.IsVisible and let skinner postpone animation start. That way skinner has most control over animation start. What do You think?
I agree on doing animation if condition is true, even on not yet visible items (that don't fit in the list height). And letting skinners do any delays themselves with ListItem.IsVisible.

Here is the example i was playing with: http://pastebin.com/sQXZEJFh
The settings submenu should come low enough to show the current 'one by one' animation behavior when scrolling down.
Movie / tvshow submenu items onclick won't work, they use playlists.