add scope

This commit is contained in:
Felix Roos
2022-03-30 11:56:13 +02:00
parent 8919524432
commit 5a255350b4
+3 -2
View File
@@ -1,8 +1,8 @@
<input
type="text"
id="text"
value="cat(880, 440, 220, 440).div(2).slow(2)"
style="width: 100%; font-size: 2em; outline: none; margin-bottom: 10px"
value="sequence(888, [432, 666], 444, 666).div(slowcat(3,2).slow(2)).off(1/8,mul(2)).off(1/4,mul(3))"
style="width: 100%; outline: none; margin-bottom: 10px"
spellcheck="false"
/>
<button id="start">start</button>
@@ -66,6 +66,7 @@
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.0.2');
const { cat, State, TimeSpan } = strudel;
let pattern;
Object.assign(window, strudel); // add strudel to eval scope
const input = document.getElementById('text');
const evaluate = () => {
pattern = eval(input.value);