JS Math

Use JavaScript to perform mathematical operations on values.

Expression - an area to input mathematical operations/JavaScript expressions.

Add - use this button to add more indices to the UI.

0: Number - the first index in the array

To reference a row in your expression use the syntax n[index number]. For example, to reference the index labelled 0: Number use the syntax n0.

Example - adding the values of two attributes together.

  1. Create 3 Shapes.

  2. Create a JS Math Atom.

  3. Connect basicShape1.position.x > jsmath.number0

  4. Connect basicShape2.position.x > jsmath.number1

  5. Enter n0 + n1 into the Expression input.

  6. Connect jsmath.id > basicShape3.position.x to output the result.

Example - move one shape in X at a value of ofAnotherShape\sqrt{ofAnotherShape}

  1. Create 2 Shapes.

  2. Create a JS Math Atom.

  3. Connect basicShape1.position.x > jsmath.number0

  4. Enter Math.sqrt(n0) into the Expression input.

  5. Connect jsmath.id > basicShape2.position.x

See https://htmlcheatsheet.com/js/# for some JavaScript syntax.

To remove indices from the array, right click on a row and choose Delete [row number]