add Pattern.len

This commit is contained in:
Felix Roos 2022-03-04 00:06:26 +01:00
parent e78b3a88d7
commit 52da8552ef

View File

@ -744,6 +744,11 @@ class Pattern {
hush() {
return silence;
}
_len(value) {
// return this.withEventSpan((span) => new TimeSpan(span.begin, span.begin.add(span.end.sub(span.begin).mul(value))));
return this.withEventSpan((span) => new TimeSpan(span.begin, span.begin.add(value)));
}
/*
_resolveTies() {
return this._withEvents((events)=>{
@ -763,7 +768,7 @@ class Pattern {
}
// methods of Pattern that get callable factories
Pattern.prototype.patternified = ['apply', 'fast', 'slow', 'early', 'late'];
Pattern.prototype.patternified = ['apply', 'fast', 'slow', 'early', 'late', 'len'];
// methods that create patterns, which are added to patternified Pattern methods
Pattern.prototype.factories = { pure, stack, slowcat, fastcat, cat, timeCat, sequence, polymeter, pm, polyrhythm, pr};
// the magic happens in Pattern constructor. Keeping this in prototype enables adding methods from the outside (e.g. see tonal.ts)