Skip to content

Commit

Permalink
moar
Browse files Browse the repository at this point in the history
  • Loading branch information
pydanny committed Apr 27, 2012
1 parent 61b4104 commit efc6a2c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion JSLA/20120426.rst
Expand Up @@ -195,9 +195,30 @@ Sample

ears.updateAudio(0.5);

ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.clearRect(0, 0, canvas.width, canvas.height);

ctx.fillStyle = "rgb(80,80,80)";

var w = Math.floor(canvas.width / 3);
ctx.fillRect(0 * w, canvas.height, w, -canvas.height * ears.lows());
ctx.fillRect(1 * w, canvas.height, w, -canvas.height * ears.mids());
ctx.fillRect(2 * w, canvas.height, w, -canvas.height * ears.highs());

With vcolors

.. sourcecode:: javascript::

ears.updateAudio(0.5);

ctx.clearRect(0, 0, canvas.width, canvas.height);

/* adding colors */
var red = Math.round(ears.lows()*255),
green = Math.round(ears.mids()*255),
blue = Math.round(ears.mids()*255);
ctx.fillStyle = "rgb("+red+","+green+","+blue+")";

var w = Math.floor(canvas.width / 3);
ctx.fillRect(0 * w, canvas.height, w, -canvas.height * ears.lows());
ctx.fillRect(1 * w, canvas.height, w, -canvas.height * ears.mids());
Expand Down

0 comments on commit efc6a2c

Please sign in to comment.