Object | Number | Text | Color | Coord | List | |
Object |
Object stacking The second object is stacked on top of the first object, and a composite object is returned. |
– | – | – | – | – |
Number | – | Numerical addition | – | – | – | – |
Text | – | – | Text concatenation | – | – | – |
Color | – | – | – |
Color mixing Mixing two colors is defined as the resulting color when their red color values are averaged, their green color values are averaged, and their blue color values are averaged. NOTE: One of the operands must be explicitly declared as a Color to avoid text concatenation instead. |
– | – |
Coordinates | – | – | – | – |
Coordinate addition The x-coordinate of the resulting coordinate pair is the sum of the x-coordinates of the operands. The y-coordinate of the resulting coordinate pair is the sum of the y-coordinates of the operands. |
– |
List | – | – | – | – | – | List concatenation |
Example:
house: Object square = rectangle(33, 70, 50, 50) roof = triangle(30, 75, 58, 20, 86, 75) house = square + roof x = 100 y = 3 txt = "frame" new_txt = "Ani" + txt color1: Color = "#FFFF00" color2 = "rgb(0, 0, 255)" coord_a = {5, 6} list1 = ["a", "b", "c"] list2 = [1, 2, 3] list3 = list1 + list2 info(x + y) info(new_txt) info(color1 + color2) info(coord_a + {6, 4}) info(list3) house.draw(1, 1000)
Output:
103 Aniframe rgb(127, 127, 127) (11, 10) [{'value': 'a', 'data_type': 'Text'}, {'value': 'b', 'data_type': 'Text'}, {'value': 'c', 'data_type': 'Text'}, {'value': 1, 'data_type': 'Number'}, {'value': 2, 'data_type': 'Number'}, {'value': 3, 'data_type': 'Number'}]
Object | Number | Text | Color | Coord | List | |
Object | – | – | – | – | – | – |
Number | – | Numerical subtraction | – | – | – | – |
Text | – | – | – | – | – | – |
Color | – | – | – |
Color mixing with inverse The inverse of the second operand (color) is computed by subtracting the red, green, and blue values from 255. The inverse of the second operand is mixed with the first operand, and the resulting color is returned. NOTE: One of the operands must be explicitly declared as a Color to avoid subtraction of text, which is invalid. |
– | – |
Coordinates | – | – | – | – |
Coordinate subtraction The x-coordinate of the resulting coordinate pair is the difference of the x-coordinates of the operands. The y-coordinate of the resulting coordinate pair is the difference of the y-coordinates of the operands. |
– |
List | – | – | – | – | – | – |
Example:
x = 100 y = 3 color1 = "#00FF00" color2: Color = "rgb(0, 0, 255)" coord_a = {5, 6} info(x - y) info(color1 - color2) info(coord_a - {6, 4})
Output:
97 rgb(0, 127, 127) (-1, 2)
Object | Number | Text | Color | Coord | List | |
Object | – | – | – | – | – | – |
Number | – | Numerical multiplication | – | – | – | – |
Text | – | – | – | – | – | – |
Color | – | – | – | – | – | – |
Coordinates | – | – | – | – |
Coordinate multiplication The x-coordinate of the resulting coordinate pair is the product of the x-coordinates of the operands. The y-coordinate of the resulting coordinate pair is the product of the y-coordinates of the operands. |
– |
List | – | – | – | – | – | – |
Example:
x = 100 y = 3 coord_a = {5, 6} coord_b = {6, 4} info(x * y) info(coord_a * coord_b)
Output:
300 (30, 24)
Object | Number | Text | Color | Coord | List | |
Object | – | – | – | – | – | – |
Number | – | Numerical division | – | – | – | – |
Text | – | – | – | – | – | – |
Color | – | – | – | – | – | – |
Coordinates | – | – | – | – |
Coordinate division
The x-coordinate of the resulting coordinate pair is the quotient of the x-coordinates of the operands. The y-coordinate of the resulting coordinate pair is the quotient of the y-coordinates of the operands. |
– |
List | – | – | – | – | – | – |
Example:
x = 100 y = 3 coord_a = {5, 6} info(x / y) info(coord_a / {6, 4})
Output:
33.333333333333336 (0.8333333333333334, 1.5)
Object | Number | Text | Color | Coord | List | |
Object | – | – | – | – | – | – |
Number | – | Numerical modulo | – | – | – | – |
Text | – | – | – | – | – | – |
Color | – | – | – | – | – | – |
Coordinates | – | – | – | – | – | – |
List | – | – | – | – | – | – |
Example:
x = 100 y = 3 info(x % y)
Output:
1
+=, -=, *=, /=, and %= are supported.
Example:
x = 100 y = 3 x += y info(x) x -= y info(x) x *= y info(x) x /= y info(x) x %= y info(x)
Output:
103 100 300 100.0 1
<, <=, >, >=, !=, and == are supported.
These operations are defined for the following operands:
Example:
info(-48.3 <= 0) info("banana" < "Aniframe") info({5, 6} != {6, 4})
Output:
1 0 1
&&, ||, and ! are supported. Short-circuiting is also enforced.
These operations are defined only when both operands are numbers (or, in the case of ||, if the sole operand is a number):
Example:
info(-48.3 && 0) info(-48.3 || 0) info(!(-48.3 && 0))
Output:
0 1 1
Note that:
Highest Precedence |
() (grouping symbols), [] (enclosing symbols for List), {} (enclosing symbols for Coord) |
. |
+ (unary), - (unary), ! |
*, /, % |
+ (binary), - (binary) |
<, <=, >, >=, !=, ==, |
&& |
|| |
= (assignment) |
Lowest Precedence |