From ec90f3c70860f50d84b323b572482566eb8b5e29 Mon Sep 17 00:00:00 2001 From: sdclibbery Date: Sun, 12 Apr 2015 23:50:04 +0100 Subject: [PATCH] fireworks burst with height corresponding to note pitch --- perform.js | 2 +- stars.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/perform.js b/perform.js index 0f86f8c..16ad7c7 100644 --- a/perform.js +++ b/perform.js @@ -8,7 +8,7 @@ musis.perform.beat = function (play, stars, events, terrain, notes) { terrain.nextHarmony(notes); events.map(function (event) { play.chorus(event.time, event.note.freq(), event.duration); - stars.burst(event.note.solfege); // if event is later in the beat, this should be delayed + stars.burst(event.note); // if event is later in the beat, this should be delayed }); }; diff --git a/stars.js b/stars.js index d5f5872..ac285a5 100644 --- a/stars.js +++ b/stars.js @@ -11,13 +11,13 @@ musis.stars = function () { musis.stars.prototype.render = function (draw) { this.bursts.map(function (burst) { var x = Math.random()*1.8-0.9; - var y = Math.random()*0.5; + var y = burst.absChromatic()/70 - 0.3;//Math.random()*0.5; var size = 0.1+Math.random()*0.3; for (var i = 0; i < numStarInBurst; i++) { var speed = size*Math.pow(Math.random(), 0.25); var theta = Math.random()*6.28; draw.addStar({ - pitchClass: burst, + pitchClass: burst.solfege, x: x, y: y, vx: speed*Math.cos(theta), @@ -30,8 +30,8 @@ musis.stars.prototype.render = function (draw) { draw.stars(); }; -musis.stars.prototype.burst = function (solfege) { - this.bursts.push(solfege); +musis.stars.prototype.burst = function (note) { + this.bursts.push(note); }; })(); \ No newline at end of file