diff --git a/README.md b/README.md index 2c310b5..38fcafd 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,11 @@ To evaluate code, press `Ctrl+Enter` (no visible animation). This is true for ev # TODO +## API + +- [ ] Give information about its context of execution to every script + - knowing which internal iterator to use for each script would be nice + ## Scheduler - [ ] Stable / robust clock and script/event scheduler. diff --git a/src/API.ts b/src/API.ts index b02190b..2ed3e56 100644 --- a/src/API.ts +++ b/src/API.ts @@ -93,8 +93,6 @@ export class UserAPI { return this.app._mouseY } - - // ============================================================= // Utility functions // ============================================================= @@ -363,9 +361,14 @@ export class UserAPI { return final_pulses.some(p => p == true) } - every(...n: number[]): boolean { - return n.some(n => this.i % n === 0) + stop(): void { + this.app.clock.pause() + this.app.setButtonHighlighting("pause", true); } + silence = this.stop + hush = this.stop + + prob(p: number): boolean { return Math.random() * 100 < p } mod(...pulse: number[]): boolean { return pulse.some(p => this.app.clock.time_position.pulse % p === 0) } modbar(...bar: number[]): boolean { return bar.some(b => this.app.clock.time_position.bar % b === 0) } diff --git a/src/main.ts b/src/main.ts index 1b5f309..32a3b99 100644 --- a/src/main.ts +++ b/src/main.ts @@ -45,7 +45,6 @@ export class Editor { clock: Clock; manualPlay: boolean = false; - // Mouse position public _mouseX: number = 0; public _mouseY: number = 0;