Rewrite part of evaluation logic, run prettier
This commit is contained in:
@ -18,13 +18,13 @@ Some features are here "just for fun" or "just because I can". They are not very
|
||||
[Hydra](https://hydra.ojack.xyz/?sketch_id=mahalia_1) is a popular live-codable video synthesizer developed by [Olivia Jack](https://ojack.xyz/) and other contributors. It follows the metaphor of analog synthesizer patching to allow its user to create complex live visuals from a web browser window. Being very easy to use, extremely powerful and also very rewarding to use, Hydra has become a popular choice for adding visuals into a live code performance. Topos provides a simple way to integrate Hydra into a live coding session and to blend it with regular Topos code.
|
||||
|
||||
${makeExample(
|
||||
"Hydra integration",
|
||||
`beat(4) :: app.hydra.osc(3, 0.5, 2).out()`,
|
||||
true
|
||||
)}
|
||||
"Hydra integration",
|
||||
`beat(4) :: app.hydra.osc(3, 0.5, 2).out()`,
|
||||
true,
|
||||
)}
|
||||
|
||||
You may feel like it's doing nothing! Press ${key_shortcut(
|
||||
"Ctrl+D"
|
||||
"Ctrl+D",
|
||||
)} to close the documentation. **Boom, all shiny!**
|
||||
|
||||
Be careful not to call <ic>app.hydra</ic> too often as it can impact performances. You can use any rhythmical function like <ic>mod()</ic> function to limit the number of function calls. You can write any Topos code like <ic>[1,2,3].beat()</ic> to bring some life and movement in your Hydra sketches.
|
||||
@ -32,13 +32,13 @@ Be careful not to call <ic>app.hydra</ic> too often as it can impact performance
|
||||
Stopping **Hydra** is simple:
|
||||
|
||||
${makeExample(
|
||||
"Stopping Hydra",
|
||||
`
|
||||
"Stopping Hydra",
|
||||
`
|
||||
beat(4) :: stop_hydra() // this one
|
||||
beat(4) :: app.hydra.hush() // or this one
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true,
|
||||
)}
|
||||
|
||||
I won't teach you how to play with Hydra. You can find some great resources on the [Hydra website](https://hydra.ojack.xyz/):
|
||||
- [Hydra interactive documentation](https://hydra.ojack.xyz/docs/)
|
||||
@ -50,8 +50,8 @@ I won't teach you how to play with Hydra. You can find some great resources on t
|
||||
Topos embeds a small <ic>.gif</ic> picture player with a small API. GIFs are automatically fading out after the given duration. Look at the following example:
|
||||
|
||||
${makeExample(
|
||||
"Playing many gifs",
|
||||
`
|
||||
"Playing many gifs",
|
||||
`
|
||||
beat(0.25)::gif({
|
||||
url:v('gif')[$(1)%6], // Any URL will do!
|
||||
opacity: r(0.5, 1), // Opacity (0-1)
|
||||
@ -62,8 +62,8 @@ beat(0.25)::gif({
|
||||
rotation: ir(1, 360), // Rotation (in degrees)
|
||||
posX: ir(1,1200), // CSS Horizontal Position
|
||||
posY: ir(1, 800), // CSS Vertical Position
|
||||
`, true
|
||||
)}
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
`;
|
||||
};
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@ export const oscilloscope = (application: Editor): string => {
|
||||
You can turn on the oscilloscope to generate interesting visuals or to inspect audio. Use the <ic>scope()</ic> function to turn it on and off. The oscilloscope is off by default.
|
||||
|
||||
${makeExample(
|
||||
"Oscilloscope configuration",
|
||||
`
|
||||
"Oscilloscope configuration",
|
||||
`
|
||||
scope({
|
||||
enabled: true, // off by default
|
||||
color: "#fdba74", // any valid CSS color or "random"
|
||||
@ -23,12 +23,12 @@ scope({
|
||||
refresh: 1 // refresh rate (in pulses)
|
||||
})
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true,
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"Demo with multiple scope mode",
|
||||
`
|
||||
"Demo with multiple scope mode",
|
||||
`
|
||||
rhythm(.5, [4,5].dur(4*3, 4*1), 8)::sound('fhardkick').out()
|
||||
beat(0.25)::sound('square').freq([
|
||||
[250, 250/2, 250/4].pick(),
|
||||
@ -44,8 +44,8 @@ scope({enabled: true, thickness: 8,
|
||||
color: ['purple', 'green', 'random'].beat(),
|
||||
size: 0.5, fftSize: 2048})
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true,
|
||||
)}
|
||||
|
||||
Note that these values can be patterned as well! You can transform the oscilloscope into its own light show if you want. The picture is not stable anyway so you won't have much use of it for precision work :)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user