Skip to content

Commit

Permalink
fireworks burst with height corresponding to note pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
sdclibbery committed Apr 12, 2015
1 parent ea53a30 commit ec90f3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion perform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
};

Expand Down
8 changes: 4 additions & 4 deletions stars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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);
};

})();

0 comments on commit ec90f3c

Please sign in to comment.