guitar chord html5,GitHub - acspike/ChordJS: Draw guitar chord diagrams on HTML5 canvas

ChordJS

Draw guitar chord diagrams on HTML5 canvas

Chords.js is a small javascript library to generate images of guitar chords in HTML. It can display chord boxes, starting frets, barred chords, fingerings and open and muted strings. Based on: http://einaregilsson.com/chord-image-generator/

The original library is a .Net web service that converts urls like:

into images like:

3a5d3ff98f4709cf7a1fed40a221ebf1.png

953d5cf8e47acb039ff70c0de6c1a6ec.png

c4b36b73b90847ec725ebbf0db9a6cf4.png

There is a small example website at http://chords.einaregilsson.com where you can try different chords and see how they are constructed for the original library.

To use chords.js you can simply convert the url format of the parent library into markup as follows:

Then include script similar to the following on your page:

Documentation

Syntax

elements

ChordJS.generate(name, positions, fingering, size, layout, strings)

Returns a chord diagram as a canvas element, which can easily be added to the DOM.

Options

name

Name of the Chord. E.g.: C#

positions

Fret positions for each string. Muted string = x; Open string = 0. E.g.: x02220

fingers

Fingers to use for each string. No finger = -. E.g.: --123- (you can use different characters if you like)

size

The size of the chord diagram to generate. E.g.: 3 for medium size or 5 for a pretty big size.

layout (optional, default: '1')

The layout for the chord diagram.

'1' would draw the finger names onto the strings and show the string names below the diagram.

'2' would draw the finger names below the chord diagrams and not dispaly the string names.

strings (optional)

Names of the strings. E.g. EADGBe for standard tuning.

ChordJS.replace(baseElement)

Replace elements with rendered chord diagrams.

baseElement (optional)

The element in which to replace the elements.

License

The source is licensed under the GPL.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值