Add invert character

alternate-visualiser
William Toohey 10 years ago
parent f4c587b47c
commit df8bec1f02
  1. 27
      js/HuesCore.js

@ -33,6 +33,7 @@ function HuesCore(defaults) {
this.colourIndex=0x3f; this.colourIndex=0x3f;
this.imageIndex=-1; this.imageIndex=-1;
this.isFullAuto = true; this.isFullAuto = true;
this.invert = false;
this.loopCount=0; this.loopCount=0;
this.fadeOut=false; this.fadeOut=false;
this.fadeDirection=false; this.fadeDirection=false;
@ -195,6 +196,7 @@ HuesCore.prototype.setSong = function(index) {
break; break;
} }
} }
this.setInvert(false);
var that = this; var that = this;
this.soundManager.playSong(this.currentSong, this.doBuildup, function() { this.soundManager.playSong(this.currentSong, this.doBuildup, function() {
that.resetAudio(); that.resetAudio();
@ -398,11 +400,19 @@ HuesCore.prototype.beater = function(beat) {
this.renderer.doColourFade(fadeLen * this.beatLength); this.renderer.doColourFade(fadeLen * this.beatLength);
this.randomColour(true); this.randomColour(true);
break; break;
case 'I':
if (this.isFullAuto) {
this.randomImage();
}
/* falls through */
case 'i':
this.toggleInvert();
break;
} }
if ([".", "+", "|", "¤"].indexOf(beat) == -1) { if ([".", "+", "|", "¤"].indexOf(beat) == -1) {
this.renderer.clearBlackout(); this.renderer.clearBlackout();
} }
if([".", "+", ":", "*", "X", "O", "~", "="].indexOf(beat) == -1) { if([".", "+", ":", "*", "X", "O", "~", "=", "i", "I"].indexOf(beat) == -1) {
this.randomColour(); this.randomColour();
if (this.isFullAuto) { if (this.isFullAuto) {
this.randomImage(); this.randomImage();
@ -441,6 +451,21 @@ HuesCore.prototype.toggleFullAuto = function() {
this.setIsFullAuto(!this.isFullAuto); this.setIsFullAuto(!this.isFullAuto);
}; };
HuesCore.prototype.setInvert = function(invert) {
this.invert = invert;
if(invert) {
document.documentElement.style.filter = "invert(100%)";
document.documentElement.style.webkitFilter = "invert(100%)";
} else {
document.documentElement.style.filter = "";
document.documentElement.style.webkitFilter = "";
}
}
HuesCore.prototype.toggleInvert = function() {
this.setInvert(!this.invert);
}
/*HuesCore.prototype.enterFrame = function() { /*HuesCore.prototype.enterFrame = function() {
this.setTexts(); this.setTexts();
if (this.fadeOut) { if (this.fadeOut) {

Loading…
Cancel
Save