add more functions
This commit is contained in:
@ -36,6 +36,11 @@ To evaluate code, press `Ctrl+Enter` (no visible animation). This is true for ev
|
|||||||
|
|
||||||
# TODO
|
# 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
|
## Scheduler
|
||||||
|
|
||||||
- [ ] Stable / robust clock and script/event scheduler.
|
- [ ] Stable / robust clock and script/event scheduler.
|
||||||
|
|||||||
11
src/API.ts
11
src/API.ts
@ -93,8 +93,6 @@ export class UserAPI {
|
|||||||
return this.app._mouseY
|
return this.app._mouseY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
// Utility functions
|
// Utility functions
|
||||||
// =============================================================
|
// =============================================================
|
||||||
@ -363,9 +361,14 @@ export class UserAPI {
|
|||||||
return final_pulses.some(p => p == true)
|
return final_pulses.some(p => p == true)
|
||||||
}
|
}
|
||||||
|
|
||||||
every(...n: number[]): boolean {
|
stop(): void {
|
||||||
return n.some(n => this.i % n === 0)
|
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) }
|
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) }
|
modbar(...bar: number[]): boolean { return bar.some(b => this.app.clock.time_position.bar % b === 0) }
|
||||||
|
|||||||
@ -45,7 +45,6 @@ export class Editor {
|
|||||||
clock: Clock;
|
clock: Clock;
|
||||||
manualPlay: boolean = false;
|
manualPlay: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
// Mouse position
|
// Mouse position
|
||||||
public _mouseX: number = 0;
|
public _mouseX: number = 0;
|
||||||
public _mouseY: number = 0;
|
public _mouseY: number = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user