This commit is contained in:
Felix Roos
2022-03-12 21:58:47 +01:00
parent 92937fa72e
commit 04d14dea90
5 changed files with 18 additions and 17 deletions
@@ -136163,7 +136163,8 @@ _strudelMjs.Pattern.prototype.pianoroll = function({ timeframe =10 , inactive ='
const margin = 0;
ctx.fillRect(x - offset + margin + 1, y + 1, width - 2, height - 2);
});
}, timeframe * 2);
}, timeframe, 2 // lookaheadCycles
);
return this;
};
@@ -136188,22 +136189,22 @@ const getDrawContext = (id = 'test-canvas')=>{
}
return canvas.getContext('2d');
};
_strudelMjs.Pattern.prototype.draw = function(callback, queryDuration) {
_strudelMjs.Pattern.prototype.draw = function(callback, cycleSpan, lookaheadCycles = 1) {
if (window.strudelAnimation) cancelAnimationFrame(window.strudelAnimation);
const ctx = getDrawContext();
let cycle, events = [];
const animate = (time)=>{
const t = _tone.getTransport().seconds;
if (queryDuration) {
const currentCycle = Math.floor(t / queryDuration);
if (cycleSpan) {
const currentCycle = Math.floor(t / cycleSpan);
if (cycle !== currentCycle) {
cycle = currentCycle;
const begin = currentCycle * queryDuration;
const end = (currentCycle + 1) * queryDuration;
const begin = currentCycle * cycleSpan;
const end = (currentCycle + lookaheadCycles) * cycleSpan;
events = this.add(0).query(new State(new TimeSpan(begin, end)));
}
}
callback(ctx, events, t, queryDuration, time);
callback(ctx, events, t, cycleSpan, time);
window.strudelAnimation = requestAnimationFrame(animate);
};
requestAnimationFrame(animate);
@@ -182990,4 +182991,4 @@ exports.default = cx;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
//# sourceMappingURL=index.9717dc33.js.map
//# sourceMappingURL=index.a8828e57.js.map
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -11,6 +11,6 @@
<body>
<div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/tutorial/index.9717dc33.js" defer=""></script>
<script src="/tutorial/index.a8828e57.js" defer=""></script>
</body>
</html>