How can I do the following?

How can I do the following?

I have a widget on my main desktop. I want it to be hidden when I resume to LL, then appear with a fade in animation.

I’ve made the script below. The operations work by themselves, but when put together, nothing happens.

I guess some of these functions must be async.

var editor;

var widget = getActiveScreen().getCurrentDesktop().getItemByName(‘sectograph’);

widget.setBinding(‘i.alpha’, ‘animate(“$widgetTransparency”)’, false);

editor = LL.getVariables().edit();

editor.setInteger(‘widgetTransparency’, 0);

editor.commit();

var widgetEd = widget.getProperties().edit();

widgetEd.setInteger(‘i.alpha’, 0);

widgetEd.commit();

widget.setBinding(‘i.alpha’, ‘animate(“$widgetTransparency”)’, true);

editor = LL.getVariables().edit();

editor.setInteger(‘widgetTransparency’, 255);

editor.commit();

]]>

2 Commentsto How can I do the following?

  1. Anonymous says:

    < ![CDATA[

    Changing properties with bindings and scripts at the same time is normally not a good idea. And this can be set without scripts.



    What if you (try and check if it works):


    – set the binding of the item with the interface, don’t modify it from script.


    – on the resumed event run the action set variable and set it to 1


    – on the paused event run the action set variable and set it to 0

    ]]>

  2. Anonymous says:

    < ![CDATA[

    “Changing properties with bindings and scripts at the same time is normally not a good idea. “



    I wouldn’t have think, that this is the case with my script.


    I mean the purpose of me setting the binding from the script, was that to turn it off temporary, then turn it on, so that it doesn’t conflict with the script setting the properties itself.



    My guess is that setting bindings and/or properties is not synchronous, that is when the function call returns, the binding or property wasn’t yet changed actually.



    But thanks for the answer. Using the paused event for resetting things will solve this, I guess.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *