knobs
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:HTML and javascript knobs. Goal is to replicate the behavior of the knobs in Apple's GarageBand for iOS.
Knob.js
========

### Javascript Library for Multitouch Virtual Knobs ###

Knob.js makes it easy to include multitouch virtual knobs in your web app.

Knob.js does the heavy lifting for things like:

*    Minimum/maximum angle & value constraints.
*    Figuring out the position and angle of the indicator dot.
*    Doing the math for displaying custom rendered knobs using image sprites.

Knob.js is a purely logical component - rather than drawing or moving things around, it only crunches the numbers and gives back positions and angles. This means that you can render your virtual knobs using CSS, <canvas>, <svg>, or however you like.

- - -

### Gesture support ###

Knob.js recognizes spinning and sliding gestures. Spin the knob and it follows your finger. Start sliding up/down or left/right and it locks into the direction and acts like a slider. Mouse interaction including scrolling is also supported.



- - -

### Demos ###




**Indicator Showcase:**
CSS
 | canvas
 | SVG


**More demos coming soon**


- - -

### Usage ###

Download the [minified library](http://jherm.github.com/knobs/build/Knob.js) and include it in your html.


```html
	
```



This code creates a knob that goes from zero to eleven, starting at 220 degrees and going to -40 degrees (that's 8 o'clock to 4 o'clock for people that like thinking in clockfaces).

```html
	
```

- - -

### Acknowledgements ###

Knob.js wouldn't be here without Apple's Garageband for iOS. The designers/developers really put a lot of thought into the way a virtual knob should work. Thanks.

The layout of the javascript was heavily influenced by Zynga's Scroller.

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。