mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
Add the mousex and mousey signal
This commit is contained in:
parent
cad27301db
commit
aec7417c14
@ -86,6 +86,25 @@ export const tri2 = fastcat(isaw2, saw2);
|
||||
|
||||
export const time = signal(id);
|
||||
|
||||
|
||||
/**
|
||||
* The mouse's x or y position value ranges from 0 to 1.
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* n(mousex.segment(4).range(0,7)).scale("C:minor")
|
||||
* n(mousey.segment(4).range(0,7)).scale("C:minor")
|
||||
*
|
||||
*/
|
||||
let _mouseY=0,_mouseX=0
|
||||
document.onmousemove = (e) => {
|
||||
_mouseY = e.clientY / document.body.clientHeight;
|
||||
_mouseX = e.clientX / document.body.clientWidth;
|
||||
};
|
||||
|
||||
export const mousey = signal(() => _mouseY);
|
||||
export const mousex = signal(() => _mouseX);
|
||||
|
||||
// random signals
|
||||
|
||||
const xorwise = (x) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user