Facer Documentation logo

Math expressions can take your watch face to next level. Facer supports arithmetical operations as well as a handful of math functions. You can also drop facer tags into expressions to make them even more dynamic!

NOTE: Math expression require parentheses. So, this will work (1+1) and this will not 1+1 !

Operators

OPERATOR DEFINITION EXAMPLE EXPRESSION EXAMPLE OUTPUT
+ Addition operator (3+2) 5
- Subtraction operator (3-2) 1
* Multiplication operator (3*2) 6
/ Division operator (3/2) 1.5
% Modulo operator (5%2) 1

Constants

COSTANT DEFINITION EXAMPLE EXPRESSION EXAMPLE OUTPUT
pi Value of pi (pi) 3.141592653589793
e Value of e (e) 2.718281828459045

Functions

FUNCTION DEFINITION EXAMPLE EXPRESSION EXAMPLE OUTPUT
rand(min, max) Random number generator (rand(1, 10)) 1
wakeRand(min, max) Random number generator that's updated every time the watch face goes into active mode (wakeRand(1, 10)) 1
abs(number) Absolute value function (abs(-10)) 10
sin(number) Sine function (sin(1)) 0.8414709848078965
cos(number) Cosine function (cos(1)) 0.5403023058681398
tan(number) Tangent function (tan(1)) 1.5574077246549023
round(number) Round function (get the closest integer) (round(1.6)) 2
ceil(number) Ceiling function (gets the next highest integer) (ceil(1.2)) 2
floor(number) Floor function - gets the next lowest integer) (floor(1.6)) 1
log(number) Log function (log(2)) 0.6931471805599453
log2(number) Log base 2 function (log2(2)) 1
log10(number) Log base 10 function (log10(2)) 0.3010299956639812
sqrt(number) Square root function (sqrt(4)) 2
cbrt(number) Cube root function (cbrt(8)) 2
exp(number) Gets E to the x power (exp(2)) 7.38905609893065
expm1(number) Gets E to the x power minus 1 (expm1(2)) 6.38905609893065
deg(radians) Convert radians to degrees (deg(1)) 57.29577951308232
rad(degrees) Converts degrees to radians (rad(180)) 3.141592653589793
clamp(current, min, max) Restrict 'current' value to the 'min' & 'max' (clamp(#Ds#, 15, 45)) 31
squareWave(current, amplitude, period, xOffset) Creates a square wave pattern out of 'current' value (squareWave(#Ds#, 15, 10, 0)) 15
interpAccel(current, min, max, accelerationFactor) Creates a ease-in transition with 'current' value (interpAccel(#Ds#, 0, 60, 2)) 0.2669444444444445
interpDecel(current, min, max, accelerationFactor) Creates a ease-out transition with 'current' value (interpDecel(#Ds#, 0, 60, 2)) 0.9454258487654321
interpAccelDecel(current, min, max) Creates a ease-in-out transition with 'current' value (interpAccelDecel(#Ds#, 0, 60)) 0.5261679781214715
gyroX() Outputs the X axis of the gyro sensor, accumulated into positional coordinates 3.9241372946780517 3.9241372946780517
gyroY() Outputs the Y axis of the gyro sensor, accumulated into positional coordinates -1.0019503694835041 -1.0019503694835041
accelerometerX() Outputs the X axis of the accelerometer sensor, accumulated into positional coordinates -5.273500685642811 -5.273500685642811
accelerometerY() Outputs the Y axis of the accelerometer sensor, accumulated into positional coordinates 7.629725700177308 7.629725700177308
gyroRawX() Outputs the raw X axis of the gyro sensor, which detects rotational acceleration 6.64500963775291 6.64500963775291
gyroRawY() Outputs the raw Y axis of the gyro sensor, which detects rotational acceleration -3.9204606214134596 -3.9204606214134596
accelerometerRawX() Outputs the raw X axis of the accelerometer sensor 1.4595613230651239 1.4595613230651239
accelerometerRawY() Outputs the raw Y axis of the accelerometer sensor 9.87964297713896 9.87964297713896