Fix colour fades

serial
William Toohey 10 years ago
parent b6682c948f
commit 09cb33f3cb
  1. 13
      js/HuesCanvas.js
  2. 13
      js/HuesCore.js

@ -229,9 +229,13 @@ HuesCanvas.prototype.setImage = function(image) {
}
}
HuesCanvas.prototype.setColour = function(colour) {
this.stopFade();
this.colour = colour;
HuesCanvas.prototype.setColour = function(colour, isFade) {
if(isFade) {
this.newColour = colour;
} else {
this.stopFade();
this.colour = colour;
}
this.needsRedraw = true;
}
@ -268,12 +272,11 @@ HuesCanvas.prototype.doShortBlackout = function(beatTime) {
this.blackoutStart = 0;
}
HuesCanvas.prototype.doColourFade = function(length, newColour) {
HuesCanvas.prototype.doColourFade = function(length) {
this.colourFade = true;
this.colourFadeLength = length;
this.colourFadeStart = this.aContext.currentTime;
this.oldColour = this.colour;
this.newColour = newColour;
}
HuesCanvas.prototype.stopFade = function() {

@ -325,14 +325,14 @@ HuesCore.prototype.randomColourIndex = function() {
return index;
}
HuesCore.prototype.randomColour = function() {
HuesCore.prototype.randomColour = function(isFade) {
var index=this.randomColourIndex();
this.setColour(index);
this.setColour(index, isFade);
}
HuesCore.prototype.setColour = function(index) {
HuesCore.prototype.setColour = function(index, isFade) {
this.colourIndex = index;
this.renderer.setColour(this.colours[this.colourIndex].c);
this.renderer.setColour(this.colours[this.colourIndex].c, isFade);
this.userInterface.setColourText();
}
@ -391,8 +391,9 @@ HuesCore.prototype.beater = function(beat) {
break;
}
}
this.stopFade();
this.startFade(fadeLen * this.beatLength);
this.renderer.stopFade();
this.renderer.doColourFade(fadeLen * this.beatLength);
this.randomColour(true);
break;
}
if ([".", "+", "|", "¤"].indexOf(beat) == -1) {

Loading…
Cancel
Save