Skip to content

A dead-simple JavaScript library providing a single Knob class featuring customizability and responsitivity.

License

Notifications You must be signed in to change notification settings

ashduino101/Knob.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knob.js

A simple library for adding flashy knobs to your JavaScript pages.

Usage

Simple example:

<!-- Add these to the head of your document -->
<script src="knob.js"></script>
<link rel="stylesheet" href="knob.css">
// Parameters:
//  - element
//  - diameter (px)
//  - accent color
//  - base color
//  - minimum value
//  - maximum value
//  - initial value
let k = new Knob(document.getElementById('knob'), 48, '#d86bff', '#767680', 0, 100, 0);
// Add a handler for changes
k.onChange = value => console.log(value);
// Set a value between `min` and `max`
k.set(75);

Dependencies

None - this runs entirely within vanilla JS.

About

A dead-simple JavaScript library providing a single Knob class featuring customizability and responsitivity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published