Skip to content

Commit

Permalink
Some small fixes to sandbox.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohit Muthanna Cheppudira committed May 18, 2012
1 parent 2bbfc89 commit afa6e6d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 53 deletions.
98 changes: 46 additions & 52 deletions docs/sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@

div.egcode {
font-family: Courier;
font-size: 14px;
font-size: 12px;
}

</style>

<script>
Expand Down Expand Up @@ -130,61 +129,56 @@ <h1>The VexFlow Sandbox</h1>
</div>

<div class="content">


<h2>Have some fun!</h2>

<div class="description sandbox">
With this Vexflow live editor, you can try out some code sniplets online.
Try out the VexFlow API in this live editor.
<p/>
Start changing some code, and resulting vexflow will appear.
<br/>
<div class="editor-error"><span class="text"></span></div>
<p/>
<div class="example sandbox" example="sandbox">


<textarea id="sandbox" class="editor" style="width: 541px; height: 180px; ">
// Get the rendering context
var canvas = $("div.sandbox div.sandbox canvas")[0];

var renderer = new Vex.Flow.Renderer(canvas,
Vex.Flow.Renderer.Backends.CANVAS);
var ctx = renderer.getContext();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.setFont("Arial", 10, "").setBackgroundFillStyle("#eed");

// Create and draw the tablature stave
var tabstave = new Vex.Flow.TabStave(10, 0, 500);
tabstave.addTabGlyph();
tabstave.setContext(ctx).draw();

// Create some notes
var notes = [
// A single note
new Vex.Flow.TabNote({
positions: [{str: 3, fret: 7}],
duration: "q"}),

// A chord with the note on the 3rd string bent
new Vex.Flow.TabNote({
positions: [{str: 2, fret: 10},
{str: 3, fret: 9}],
duration: "q"}).
addModifier(new Vex.Flow.Bend("Full"), 1),

// A single note with a harsh vibrato
new Vex.Flow.TabNote({
positions: [{str: 2, fret: 5}],
duration: "h"}).
addModifier(new Vex.Flow.Vibrato().setHarsh(true).setVibratoWidth(70), 0)
];

Vex.Flow.Formatter.FormatAndDraw(ctx, tabstave, notes);
</textarea>

<textarea id="sandbox" class="editor"
style="width: 641px; height: 180px; ">
// Get the rendering context
var canvas = $("div.sandbox div.sandbox canvas")[0];

var renderer = new Vex.Flow.Renderer(canvas,
Vex.Flow.Renderer.Backends.CANVAS);
var ctx = renderer.getContext();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.setFont("Arial", 10, "").setBackgroundFillStyle("#eed");

// Create and draw the tablature stave
var tabstave = new Vex.Flow.TabStave(10, 0, 500);
tabstave.addTabGlyph();
tabstave.setContext(ctx).draw();

// Create some notes
var notes = [
// A single note
new Vex.Flow.TabNote({
positions: [{str: 3, fret: 7}],
duration: "q"}),

// A chord with the note on the 3rd string bent
new Vex.Flow.TabNote({
positions: [{str: 2, fret: 10},
{str: 3, fret: 9}],
duration: "q"}).
addModifier(new Vex.Flow.Bend("Full"), 1),

// A single note with a harsh vibrato
new Vex.Flow.TabNote({
positions: [{str: 2, fret: 5}],
duration: "h"}).
addModifier(new Vex.Flow.Vibrato().setHarsh(true).setVibratoWidth(70), 0)
];

Vex.Flow.Formatter.FormatAndDraw(ctx, tabstave, notes);</textarea>
<p/>
<canvas width=525 height=160></canvas>
<canvas width=625 height=160></canvas>

<style>
.editor {
Expand Down Expand Up @@ -212,7 +206,7 @@ <h2>Have some fun!</h2>

function live_code() {
var code = $("#sandbox").val();

try {
eval(code);
msg.html('').hide();
Expand All @@ -234,9 +228,9 @@ <h2>Have some fun!</h2>
</div>

<center>
<h2>For help, please read the tutorial</h2>
<p/>
<a href="tutorial.html">Tutorial</a><p/>
<h2>
Confused? Go read the <a href="tutorial.html">tutorial</a>.
</h2>
</center>
</div>
</body>
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@ <h2>Step 5: Guitar Tablature</h2>

<center>
<h2>Step N + 1: More coming soon...</h2>
Meanwhile, you can experiment with <a href="sandbox.html">Vexflow online</a>.
Meanwhile, go ahead and experiment in the
<a href="sandbox.html">Vexflow Sandbox</a>.
<p/>
<a href="http://0xfe.blogspot.com">The Blog</a><p/>
</center>
Expand Down

0 comments on commit afa6e6d

Please sign in to comment.