Hi

Hi,

need help with bindings. 

i added a binding to an item with transparency like this:

animate(“$t_val”,100,”li”,200);

last parameter means: The animation offset in milliseconds. (optional, default is 0ms)

depending on another variable $t_on_off (true/false) i like to have a different offset.

animate(“$t_val”,100,”li”,$t_offset); does not work.

also 

 if ($t_on_off == true) {animate(“t_val”,100,”li”,0) } else {animate(“t_val”,100,”li”,1000)} 

does not work.

any other ideas to get it ?

]]>

15 Commentsto Hi

  1. Anonymous says:

    < ![CDATA[

    For multi line bindings you need to use return



     if ($t_on_off == true) {return animate(“$t_val”,100,”li”,0) } else {return animate(“$t_val”,100,”li”,1000)} 




    Advanced: you can use the ternary operator ?: to collapse it to one line:



    animate(“$t_val”,100,”li”,$t_on_off?0:1000)

    ]]>

  2. Anonymous says:

    < ![CDATA[

    TrianguloY


    both does not work



    android 5.0.2


    LL 12.5.2

    ]]>

  3. Anonymous says:

    < ![CDATA[

    But what does not work?

    ]]>

  4. Anonymous says:

    < ![CDATA[

    TrianguloY the offset


    only when i enter:


    animate(“$t_val”,100,”li”,200);



    all other variations does not

    ]]>

  5. Anonymous says:

    < ![CDATA[

    I forgot the $ in my answer.


    Edited

    ]]>

  6. Anonymous says:

    < ![CDATA[

    If not, try with this:



     if ($t_on_off == “true”) {return animate(“$t_val”,100,”li”,0) } else {return animate(“$t_val”,100,”li”,1000)} 




    Advanced:


    animate(“$t_val”,100,”li”,$t_on_off==”true”?0:1000)

    ]]>

  7. Anonymous says:

    < ![CDATA[

    TrianguloY have you tried any of your suggestions? none of them worked for me.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    The problem is that I can’t recreate the $t_on_off value.


    How are you assigning it, and which values?

    ]]>

  9. Anonymous says:

    < ![CDATA[

    TrianguloY i used two scripts.



    1.


    var editor=LL.getVariables.edit();


    editor.setInteger(“t_val”,0);


    editor.setBoolean(“t_on_off”,false);


    editor.commit();



    2.


    var editor=LL.getVariables.edit();


    editor.setInteger(“t_val”,255);


    editor.setBoolean(“t_on_off”,true);


    editor.commit();



    for a quickshot u can try it also with LLigthningAction > set a variable



    ps: i set some more variables in my scripts, but is not important for this.

    ]]>

  10. Anonymous says:

    < ![CDATA[

    This works for me.


    (I guess your little scripts were made from memory, as they contain syntax error. )



     if ($t_on_off) {return animate(“$t_val”,100,”li”,0) } else {return animate(“$t_val”,100,”li”,1000)} 




    Advanced: you can use the ternary operator ?: to collapse it to one line:



    animate(“$t_val”,100,”li”,$t_on_off?0:1000)

    ]]>

  11. Anonymous says:

    < ![CDATA[

    TrianguloY i edited my last answer, should be ok now

    ]]>

  12. Anonymous says:

    < ![CDATA[

    TrianguloY in both variations i can not notice a delay in animation.  it always starts immediatly. only when i write


    animate(“t_val”,100,”li”,1000)


    there is a 1 second delay.

    ]]>

  13. Anonymous says:

    < ![CDATA[

    gerd reuter the problem should be the t_on_off so set the label of an item to show that value, and check if it really changes.



    The scripts are still wrong. You need to add () after getVariables


    LL.getVariables().edit() …

    ]]>

  14. Anonymous says:

    < ![CDATA[

    TrianguloY i did this before i asked this question 😉 . and yes it changes.

    ]]>

  15. Anonymous says:

    < ![CDATA[

    So…no idea.


    It works for me, doesn’t work for you. Something is wrong but I don’t know what.



    Try something. Instead of using setBoolean use setString with the values “true” , “false”


    Then use this binding


    animate(“$t_val”,100,”li”,$t_on_off==”true”?0:1000)

    ]]>

Leave a Reply

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