compose/remote/remote-core/doc/EXPRESSION_ENGINE.md
The Expression Engine allows the Player to perform mathematical calculations and logic locally, enabling smooth animations and responsive UI without constant communication with the host.
Expressions are encoded using RPN, where operands precede their operators. This allows for efficient stack-based evaluation on the player.
(A + B) * 2In RemoteCompose, this is represented as: [A_ID, B_ID, ADD, 2.0, MUL]
Time or TouchX) changes, all dependent expressions are marked "dirty".AnimatedFloatExpression.eval() iterates through the RPN array:
| Type | Operators |
|---|---|
| Arithmetic | ADD, SUB, MUL, DIV, MOD, POW |
| Trigonometry | SIN, COS, TAN, ASIN, ACOS, ATAN, ATAN2 |
| Logic | EQ, NEQ, GT, GE, LT, LE, AND, OR, IFELSE |
| Special | ABS, MIN, MAX, CLAMP, RAND, PINGPONG, SQUARE, SQRT |
| System | VAR1, VAR2 (Used in loops and path expressions) |
RemoteContext: Holds the current value of every float ID in the document.WINDOW_WIDTH, WINDOW_HEIGHTANIMATION_TIME, CONTINUOUS_SECTOUCH_X, TOUCH_Y, TOUCH_PRESSEDACCELEROMETER_X, Y, Z