- Spark AR Studio
- Spark AR Hub
- Features
- Learn
- Gallery
- Partners
- Blog
- Forum
- Create AR effects for Instagram and Facebook.Get Started

Math patches can be used to perform math operations on inputted patches.

Name | Description |
---|---|

| Delays a value by some time. |

| Returns a smoothed signal based on a damping factor measured in milliseconds. |

**Advanced**

Name | Description |
---|---|

| Calculates the arccosine of an argument. |

| Calculates the arcsine of an argument. |

| Calculates the angle of a triangle given its X and Y dimensions. |

| Calculates the cosine of an argument. |

| Calculates the natural exponentiation of an argument. |

| Calculates the natural logarithm of an argument. |

| Calculates the value of the first parameter raised to the power of the second. |

| Calculates the sine of an argument. |

| Calculates the square root of a value. |

| Calculates the tangent of an argument. |

**Basic**

Name | Description |
---|---|

| Adds two value together. |

| Rounds up a value. |

| Divides one value by another value. |

| Rounds down a value. |

| Returns the greater of two values. |

| Returns the lesser of two values. |

| Calculates remainder when two values are divided. |

| Multiplies two values. |

| Rounds a number to the nearest integer. |

| Subtracts one value from another value. |

**More**

Name | Description |
---|---|

| Calculates the absolute value of an argument. |

| Constrains a value between a minimum and maximum limit. |

| Maps a value from a specified range to the [0,1] range. |

| Perfom linear interpolation between two values modulated by an alpha value. |

| Change a value from positive to negative or from negative to positive. |

| Extracts the sign of a value. The output is -1 for negative, 0 for zero and +1 for positive. |

| Performs Hermite interpolation between two values. |

| Generates a step function by comparing two values. |

| Maps a value from the [0,1] range to a specified range. |

The patches in the tables above will apply the operation separately on each component of the input.

So, if the input is Vector2 with the values `(3.1,4.7)`

, and we used the Round patch, the outputs will be `(3, 5)`

.

This also applies if there are two inputs. If you have an input of `(5,7)`

and `(1,6)`

and we use the Add patch, the outputs will be `(6,13)`

.

The input types must be compatible, for example you can't have an input of Vector2 and input of Vector3 connected to the same Add patch. If you want to use a number and another input, for example Vector2, Spark AR Studio will automatically expand the number to the corresponding input. So, if you have an input of `(5,7)`

and the number 2 in an Add patch, the output would be `(7,9)`

.

**Vector**

Name | Description |
---|---|

| Calculates the cross product of two vectors. |

| Calculates the distance between two points. |

| Calculates the dot product of two vectors. |

| Calculates the length (or magnitude) of a value. |

| Calculates the unit value in the same direction as the original value. |

| Calculates the unit value in the same direction as the original value. |