Watchface Builder Wiki

Ultimate Watchface Builder

User Tools

Site Tools


expressions

Differences

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

Link to this comparison view

Next revision
Previous revision
expressions [2016/02/28 15:29]
Wearable Software created
expressions [2021/02/17 21:40] (current)
Line 1: Line 1:
-====== Expressions ======+====== Using expressions to create a dynamic watchface ====== 
 +Use operators, mathematical functions or conditional statements to build a more dynamic watchface.
  
 +===== Built-in operators =====
 +Watchface Builder supports following operators:
 +      * Addition: 2 + 2
 +      * Subtraction: 2 - 2
 +      * Multiplication: 2 * 2
 +      * Division: 2 / 2
 +      * Exponentation: 2 ^ 2
 +      * Unary Minus,Plus (Sign Operators): +2 - (-2)
 +      * Modulo: 2 % 2
 +
 +===== Mathematical Functions =====
 +You can also use mathematical functions for your expression. These expressions are supported:
 +
 +      * abs: absolute value
 +      * acos: arc cosine
 +      * asin: arc sine
 +      * atan: arc tangent
 +      * cbrt: cubic root
 +      * ceil: nearest upper integer
 +      * cos: cosine
 +      * cosh: hyperbolic cosine
 +      * exp: euler's number raised to the power (e^x)
 +      * floor: nearest lower integer
 +      * log: logarithmus naturalis (base e)
 +      * log10: logarithm (base 10)
 +      * log2: logarithm (base 2)
 +      * sin: sine
 +      * sinh: hyperbolic sine
 +      * sqrt: square root
 +      * tan: tangent
 +      * tanh: hyperbolic tangent
 +
 +==== Example ====
 +<code>ceil({wct})</code>
 +Returns the integer value for the current temperature
 +
 +===== Conditional statements  =====
 +You can use condition statements. The syntax is:
 +
 +<code>$condition?true value:false value$</code>
 +
 +Following operators are supported for a condition:
 +  * greater equal >=
 +  * lower equal <=
 +  * lower <
 +  * greater >
 +  * equals ==
 +  * not equals !=
 +
 +==== Example ====
 +For example if you want a blinking watchface layer set following expression on your opacity property.
 +
 +<code>${ds}%2==0?100:0$</code>
 +
 +Every time the seconds value changes and the value divided by two gives no rest, the layer will be displayed.
expressions.1456669773.txt.gz · Last modified: 2021/02/17 21:40 (external edit)