Files
hydra/docs/funcs_global-variables.md
2023-07-07 16:02:19 -07:00

36 lines
541 B
Markdown

## Global variables
Useful variables that are defined globally, and can be used within functions as a parameter.
- [mouse](#mouse)
- [time](#time)
### mouse
`mouse`
* `.x` :: x position of mouse
* `.y` :: y position of mouse
#### Example
Control the oscillator frequency with the mouse position:
```javascript
osc(() => mouse.x).out(o0)
```
### time
`time`
* `time` :: the current time
#### Example
Control the oscillator using a sine wave based on the current time:
```javascript
osc( ({time}) => Math.sin(time) ).out(o0)
```