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/05/20 09:14]
pierrox [The Lightning Action Set a variable]
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 20: Line 21:
   * Position on the grid: cell position and dimension for the item on the grid   * Position on the grid: cell position and dimension for the item on the grid
   * Position detached from the grid: free positioning and transformation (rotation, scale, etc.)   * Position detached from the grid: free positioning and transformation (rotation, scale, etc.)
-  * Item properties: generic properties for all item types (transparency,​ visibility)+  * Item properties: generic properties for all item types (transparency,​ visibility, [[bindings_box|box]])
   * Text: properties for items displaying some text (apps, shortcuts, folders, etc.). This can be the label, the font size, color, etc.   * Text: properties for items displaying some text (apps, shortcuts, folders, etc.). This can be the label, the font size, color, etc.
   * Icon: properties for items displaying an icon, such as icon scale, colorize filter.   * Icon: properties for items displaying an icon, such as icon scale, colorize filter.
Line 26: Line 27:
  
 Not all attributes supported by Lightning are available as properties in bindings. The list of properties mainly includes visual attributes. Feel free to ask for more properties if needed! Not all attributes supported by Lightning are available as properties in bindings. The list of properties mainly includes visual attributes. Feel free to ask for more properties if needed!
 +
 +The box property, available from V12.5b7, is made of many "sub properties":​ margin, padding, border color and size, background color, for left/​top/​right/​bottom side or normal/​selected/​focused states. Please refer to the [[bindings_box|box]] page for the box property syntax and how to use it.
  
 Things to be aware of: Things to be aware of:
Line 84: 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 96: 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.1432113258.txt.gz ยท Last modified: 2015/05/20 09:14 by pierrox