0.18.1 • Published 4 months ago

bndr-js v0.18.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

DocSandboxAPIBecome a Sponsor

Bndr /ˈbaɪndɚ/ is a library designed to compose events from various user inputs and chain filters in a monadic manner, integrating them into a single event object. It accommodates input devices such as mice🖱️, styluses🖊️, touch inputs👆, keyboards⌨️, MIDI controllers🎹, and gamepads🎮. Developed and maintained by Baku Hashimoto.

Potential use cases for this library include:

  • ⚡️ Associating user inputs with arbitrary triggers for VJing
  • 🎨 Introducing manual operations in generative art.

To get a feel for how it works, please try out this demo.

Supported Parameters

  • 👆 Pointer (mouse, stylus, touch)
    • All parameters supported in PointerEvent. (pressure, tilt, multi-touch)
  • ⌨️ Keyboard
  • 🎹 MIDI
    • CC and velocity
  • 🎮 Gamepad
    • Vendor-specific button name support: JoyCon, PS5 Controller

How to use

Installation

npm install bndr-js

Example

import {Bndr} from 'bndr-js'

Bndr.pointer().on(pressed =>
	console.log('Pointer %s', pressed ? 'pressed' : 'released')
)

Bndr.pointer()
	.position()
	.lerp(vec2.lerp, 0.1)
	.on(([x, y]) => console.log('Pointer moved: [%f, %f]', x, y))

Bndr.keyboard()
	.hotkey('shift+c')
	.on(() => console.log('Hotkey shift+c pressed'))

Bndr.keyboard()
	.key('a')
	.on(pressed => console.log(`Key 'a' ${pressed ? 'pressed' : 'released'}`))

Bndr.midi()
	.note(0, 50)
	.on(velocity => console.log('MIDI slider #50 moved: %d', velocity))

Bndr.gamepad()
	.axis(0)
	.on(([x, y]) => console.log('Gamepad axis #0 tilted: [%f, %f]', x, y))

License

This repository is published under an MIT License. See the included LICENSE file.

0.18.1

4 months ago

0.17.0

9 months ago

0.18.0

9 months ago

0.16.0

10 months ago

0.15.0

12 months ago

0.15.1

12 months ago

0.14.0

1 year ago

0.14.1

1 year ago

0.14.2

1 year ago

0.13.2

1 year ago

0.9.4

2 years ago

0.9.3

2 years ago

0.11.0

2 years ago

0.12.0

2 years ago

0.11.1

2 years ago

0.13.0

2 years ago

0.11.2

2 years ago

0.13.1

2 years ago

0.10.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.1

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.5.0

2 years ago

0.3.2

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago