Skip to content

Include section for non-looping fixed duration sequences #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions content/docs/learning/interactivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ The following are the available easing functions:
* sin: sinusoidal shape
---

#### Creating non-looping sequences

If you want to create a sequence that doesn't loop, you can use the `.sequence` method. This will make the sequence go through all the elements of the Array once with a fixed duration, and then stop.

```hydra
bpm = 60
arr = [0,1,0.5,2]
osc(50,.1,arr.sequence(4).smooth())
.rotate(arr.sequence(8))
.out()
```

## Custom Functions

The other main way of adding dynamic inputs to your sketches is passing functions as arguments. When Hydra takes a function as an argument, what it will do is evaluate it every time it renders a frame. The return of the function will be used as the value for that parameter during that frame render. So you can use a function to simply keep track of a value that you know will change over time, for example, mouse position (which we'll see later).
Expand Down