Skip to content

Commit

Permalink
Merge pull request #24 from vcync/feat/expressions
Browse files Browse the repository at this point in the history
feat(expressions): adds docs for expressions
  • Loading branch information
TimPietrusky authored Dec 1, 2020
2 parents 0c890ef + f3af047 commit ac911e3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ module.exports = {
collapsable: false,
children: [
'/v3/guide/',
'/v3/guide/media',
'/v3/guide/modules',
'/v3/guide/groups',
'/v3/guide/audioReactivity',
'/v3/guide/inputLinks',
'/v3/guide/media',
'/v3/guide/expressions',
'/v3/guide/shortcuts',
'/v3/guide/writingA2dModule',
],
Expand Down
40 changes: 40 additions & 0 deletions docs/v3/guide/expressions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebarDepth: 2
---

# Expressions

Found in the Input Configuration panel, Expressions allow shaping of a Module's property value.

Input from an Audio Feature, MIDI CC or Tween are all routed through the Expression, allowing Expressions to boost, dampen, shape or entirely change the incoming value.

Expressions are JavaScript syntax, anything that can be sucessfully validated in the JavaScript console.

e.g.

`value` is the incoming value.

`value * 2` doubles the incoming value.

`value / 2` halves the incoming value.

`value > 0.5 ? 10 : 0` sets the value to 10 if the incoming value is over 0.5. If under, the value will be 0.

Methods from [Math.js](https://mathjs.org/) are available in Expressions.

e.g.

`sqrt(value)`

Other variables in the scope:

|Variable|Type|Detail|
|---|---|---|
|`time`|Number|The time returned from `Date.now()`|


::: tip
Expressions get evaluated when the Module's property will update, through UI interaction or incoming value from an Input Configuration assignment.

You cannot use Expressions to create oscillating values.
:::

0 comments on commit ac911e3

Please sign in to comment.