User Tools

Site Tools


bindings

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bindings [2015/06/03 13:56]
pierrox [Property]
bindings [2015/06/21 19:21] (current)
pierrox [Bindings (variables)]
Line 2: Line 2:
 For Lighting 12.5b1 and above. For Lighting 12.5b1 and above.
  
 +**Need to set "​Expert mode" to on**
 ===== Purpose ===== ===== Purpose =====
 Bindings are an easy way to animate items. Usually items properties are set with fixed values through the configuration screens. With bindings it is possible to use dynamic values for properties. Some use cases for bindings are: set the label of a shortcut with the time or cpu usage, set the position of an item according to the orientation,​ set an icon color using the battery level, move an item upon a swipe gesture, etc. Bindings are an easy way to animate items. Usually items properties are set with fixed values through the configuration screens. With bindings it is possible to use dynamic values for properties. Some use cases for bindings are: set the label of a shortcut with the time or cpu usage, set the position of an item according to the orientation,​ set an icon color using the battery level, move an item upon a swipe gesture, etc.
Line 86: Line 87:
  
 **Important note #3:** keep in mind that animations have a cost and can drain the battery if animations are running all the time. **Important note #3:** keep in mind that animations have a cost and can drain the battery if animations are running all the time.
- 
  
 Examples: Examples:
Line 98: Line 98:
 |<​del>​animate('​$alpha/​2'​)</​del>​|Invalid expression, the first argument must be a variable name only, use the result of animate for further computation| |<​del>​animate('​$alpha/​2'​)</​del>​|Invalid expression, the first argument must be a variable name only, use the result of animate for further computation|
 |255*(animate('​$ll_second'​)%1)|Make the item blink every second| |255*(animate('​$ll_second'​)%1)|Make the item blink every second|
 +
 +==== Implicit variables ====
 +When evaluating a binding formula, the following variables are available for use in scripts:
 +  * item : the object being processed ([[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​script/​reference/​net/​pierrox/​lightning_launcher/​script/​api/​Item.html|as defined here]])
 +  * field : the internal property name, which list can be found in the [[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​script/​reference/​net/​pierrox/​lightning_launcher/​script/​api/​PropertySet.html|PropertySet]] documentation.
  
 ===== Setting variables ===== ===== Setting variables =====
bindings.1433339792.txt.gz · Last modified: 2015/06/03 13:56 by pierrox