mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 05:28:41 +00:00
Add someCycles and someCyclesBy
This commit is contained in:
parent
1274641f89
commit
1c3793e2ef
@ -142,6 +142,24 @@ Pattern.prototype.sometimesPre = function (func) {
|
|||||||
return this._sometimesByPre(0.5, func);
|
return this._sometimesByPre(0.5, func);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Pattern.prototype._someCyclesBy = function (x, func) {
|
||||||
|
return stack(
|
||||||
|
this._degradeByWith(rand._segment(1), x),
|
||||||
|
func(this._degradeByWith(rand.fmap((r) => 1 - r)._segment(1), 1 - x)),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Pattern.prototype.someCyclesBy = function (patx, func) {
|
||||||
|
const pat = this;
|
||||||
|
return reify(patx)
|
||||||
|
.fmap((x) => pat._someCyclesBy(x, func))
|
||||||
|
.innerJoin();
|
||||||
|
};
|
||||||
|
|
||||||
|
Pattern.prototype.someCycles = function (func) {
|
||||||
|
return this._someCyclesBy(0.5, func);
|
||||||
|
};
|
||||||
|
|
||||||
Pattern.prototype.often = function (func) {
|
Pattern.prototype.often = function (func) {
|
||||||
return this.sometimesBy(0.75, func);
|
return this.sometimesBy(0.75, func);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user