# Functions

## Array functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

average | 1 | array | Returns the average value from all numbers in given array. |

length | 1 | constant or array | Returns a value that represents the total number of elements in given array. Returns -1 if argument is not an array. |

max | 1 | array | Returns the maximum value from given array |

min | 1 | array | Returns the minimum value from given array. |

product | 1 | array | Returns the product of all numbers in given array. Product of an empty array is 1. |

sum | 1 | array | Returns the sum of all numbers in given array. Sum of an empty array is 0. |

## Color functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

darken | 2 | constant or array constant | Darkens given color by given amount of percent. Negative value causes lightening of color. |

lighten | 2 | constant or array constant | Lightens given color by given amount of percent. Negative value causes darkening of color. |

## Mathematical functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

factorial | 1 | constant | Returns the product of all positive integers less than or equal to given number. |

log | 1 | constant | Returns the natural (base e) logarithm of a given number. |

log | 2 | constant | Returns the logarithm of a given number in a given base. |

logBase | |||

log10 | 1 | constant | Returns the base 10 logarithm of a given number. |

sqrt | 1 | constant | Returns the square root of a given number. |

## Multi-values functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

average | any | constant | Returns the average of all given arguments. Returns NaN (not a number) if no argument is given. |

max | any | constant | Returns the average from all given arguments. Returns NaN (not a number) if no argument is given. |

min | any | constant | Returns the minimum from all given arguments. Returns NaN (not a number) if no argument is given. |

product | any | constant | Returns the product of all given arguments. Returns 1 if no argument is given. |

sum | any | constant | Returns the sum of all given arguments. Returns 0 if no argument is given. |

## Other functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

abs | 1 | constant | Returns the absolute value of given number. |

deg2rad | 1 | constant | Converts degrees to radians. |

rad2deg | 1 | constant | Converts radians to degrees. |

sign | 1 | constant | Returns a value indicating the sign of given number. Returns value -1 if given number is less than zero, 0 if is equal to zero and 1 if number is greater than zero. |

toColorGradient | 1 | array | Converts array representing color gradient to array of colors. |

toColorGradient | any | constant | Converts arguments representing color gradient to array of colors. |

## Rounding functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

ceiling | 1 | constant | Returns the smallest integer greater than or equal to the given number. |

floor | 1 | constant | Returns the largest integer less than or equal to the given number. |

round | 1 | constant | Rounds given number to the nearest integral value. If the fractional component is halfway between two integers, then the even number is returned. |

## Special functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

if | 3 | constant constant or array constant or array | If the first given value is non-zero, returns second value, otherwise returns third value. |

isInfinity | 1 | constant or array | Returns a value indicating whether the specified number is negative or positive infinity. |

isNan | 1 | constant or array | Returns a value indicating whether the given number is NaN (not a number). |

## Trigonometric functions

Name | Num of params | Parameters type pattern | Description |
---|---|---|---|

acos | 1 | constant | Returns the angle in radians whose cosine is the given number. |

asin | 1 | constant | Returns the angle in radians whose sine is the given number. |

atan | 1 | constant | Returns the angle in radians whose tangent is the given number. |

atan2 | 2 | constant | Returns the angle in radians whose tangent is the quotient of two given numbers. |

cos | 1 | constant | Returns the cosine of the specified angle in radians. |

sin | 1 | constant | Returns the sine of the specified angle in radians. |

tan | 1 | constant | Returns the tangent of the specified angle in radians. |