mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
fix: mini repls were broken
This commit is contained in:
parent
28912fff97
commit
4b79a75f39
@ -1,4 +1,4 @@
|
||||
import { controls, Pattern, getDrawContext, silence, scheduler, register, pure } from './index.mjs';
|
||||
import { controls, Pattern, getDrawContext, silence, register, pure } from './index.mjs';
|
||||
const { createParams } = controls;
|
||||
|
||||
let clearColor = '#22222210';
|
||||
@ -12,13 +12,13 @@ Pattern.prototype.animate = function ({ callback, sync = false, smear = 0.5 } =
|
||||
clearColor = `#200010${smearPart}`;
|
||||
const render = (t) => {
|
||||
let frame;
|
||||
if (sync) {
|
||||
/* if (sync) {
|
||||
t = scheduler.now();
|
||||
frame = this.queryArc(t, t);
|
||||
} else {
|
||||
t = Math.round(t);
|
||||
frame = this.slow(1000).queryArc(t, t);
|
||||
}
|
||||
} else { */
|
||||
t = Math.round(t);
|
||||
frame = this.slow(1000).queryArc(t, t);
|
||||
// }
|
||||
ctx.fillStyle = clearColor;
|
||||
ctx.fillRect(0, 0, ww, wh);
|
||||
frame.forEach((f) => {
|
||||
|
||||
@ -3,10 +3,6 @@ import { evaluate as _evaluate } from './evaluate.mjs';
|
||||
import { logger } from './logger.mjs';
|
||||
import { setTime } from './time.mjs';
|
||||
|
||||
export let scheduler; // expose scheduler to global scope
|
||||
// this is not optimal as it will only work for one repl at a time
|
||||
// TODO: use pattern.context to expose scheduler
|
||||
|
||||
export function repl({
|
||||
interval,
|
||||
defaultOutput,
|
||||
@ -18,7 +14,7 @@ export function repl({
|
||||
transpiler,
|
||||
onToggle,
|
||||
}) {
|
||||
scheduler = new Cyclist({
|
||||
const scheduler = new Cyclist({
|
||||
interval,
|
||||
onTrigger: async (hap, deadline, duration) => {
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user