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 ?
]]>
< ![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)
]]>
< ![CDATA[
TrianguloY
both does not work
android 5.0.2
LL 12.5.2
]]>
< ![CDATA[
But what does not work?
]]>
< ![CDATA[
TrianguloY the offset
only when i enter:
animate(“$t_val”,100,”li”,200);
all other variations does not
]]>
< ![CDATA[
I forgot the $ in my answer.
Edited
]]>
< ![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)
]]>
< ![CDATA[
TrianguloY have you tried any of your suggestions? none of them worked for me.
]]>
< ![CDATA[
The problem is that I can’t recreate the $t_on_off value.
How are you assigning it, and which values?
]]>
< ![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.
]]>
< ![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)
]]>
< ![CDATA[
TrianguloY i edited my last answer, should be ok now
]]>
< ![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.
]]>
< ![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() …
]]>
< ![CDATA[
TrianguloY i did this before i asked this question 😉 . and yes it changes.
]]>
< ![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)
]]>