Revert "Trippy Mode initial"

This reverts commit acd51c6e89.
master
William Toohey 10 years ago
parent acd51c6e89
commit 86abe870e0
  1. 35
      js/HuesCanvas.js
  2. 8
      js/HuesSettings.js

@ -47,9 +47,6 @@ function HuesCanvas(element, aContext, core) {
this.blurDistance = 0; this.blurDistance = 0;
this.xBlur = false; this.xBlur = false;
this.yBlur = false; this.yBlur = false;
this.trippyStart = 0;
this.xLast = false;
this.blackout = false; this.blackout = false;
this.blackoutColour = "#000"; // for the whiteout case we must store this this.blackoutColour = "#000"; // for the whiteout case we must store this
@ -67,8 +64,6 @@ function HuesCanvas(element, aContext, core) {
this.setBlurQuality("high"); this.setBlurQuality("high");
this.setBlurDecay("fast"); this.setBlurDecay("fast");
this.canvas = document.getElementById(element).getContext("2d"); this.canvas = document.getElementById(element).getContext("2d");
this.offscreenCanvas = document.createElement('canvas').getContext('2d');
this.offscreenCanvas.globalCompositeOperation = "source-over";
window.addEventListener('resize', this.resizeHandler(this)); window.addEventListener('resize', this.resizeHandler(this));
this.resize(); this.resize();
@ -90,8 +85,6 @@ HuesCanvas.prototype.resize = function() {
// height is constant 720px, we expand width to suit // height is constant 720px, we expand width to suit
var ratio = window.innerWidth / window.innerHeight; var ratio = window.innerWidth / window.innerHeight;
this.canvas.canvas.width = Math.ceil(720 * ratio); this.canvas.canvas.width = Math.ceil(720 * ratio);
this.offscreenCanvas.canvas.height = this.canvas.canvas.height;
this.offscreenCanvas.canvas.width = this.canvas.canvas.width;
var snow = document.getElementById("snow").getContext("2d"); var snow = document.getElementById("snow").getContext("2d");
snow.canvas.width = Math.ceil(720 * ratio); snow.canvas.width = Math.ceil(720 * ratio);
this.needsRedraw = true; this.needsRedraw = true;
@ -166,28 +159,10 @@ HuesCanvas.prototype.redraw = function() {
this.canvas.drawImage(bitmap, offset, 0); this.canvas.drawImage(bitmap, offset, 0);
} }
} }
this.offscreenCanvas.fillStyle = this.intToHex(0xFFFFFF ^ this.colour);
this.offscreenCanvas.fillRect(0,0,width,720);
if(this.trippyStart && localStorage["trippyMode"] == "on") {
var larger = Math.max(width, this.canvas.canvas.height) / 2;
var radius = Math.floor((cTime - this.trippyStart) * larger) * 2;
if(radius > larger) {
this.trippyStart = 0;
} else {
this.offscreenCanvas.fillStyle = this.intToHex(this.colour);
this.offscreenCanvas.beginPath();
if(this.xLast) {
radius = larger - radius;
}
this.offscreenCanvas.arc(width/2, this.canvas.canvas.height/2, radius, 0, 2 * Math.PI, false);
this.offscreenCanvas.fill();
this.offscreenCanvas.closePath();
}
}
this.canvas.globalAlpha = 0.7; this.canvas.globalAlpha = 0.7;
this.canvas.fillStyle = this.intToHex(this.colour);
this.canvas.globalCompositeOperation = this.blendMode; this.canvas.globalCompositeOperation = this.blendMode;
this.canvas.drawImage(this.offscreenCanvas.canvas, 0, 0); this.canvas.fillRect(0,0,width,720);
if(this.blackout) { if(this.blackout) {
this.canvas.globalAlpha = bOpacity; this.canvas.globalAlpha = bOpacity;
this.canvas.fillStyle = this.blackoutColour; this.canvas.fillStyle = this.blackoutColour;
@ -260,7 +235,7 @@ HuesCanvas.prototype.animationLoop = function() {
this.blurStart = 0; this.blurStart = 0;
this.xBlur = this.yBlur = false; this.xBlur = this.yBlur = false;
this.redraw(); this.redraw();
} else if(this.blurStart || this.trippyStart) { } else if(this.blurStart) {
this.redraw(); this.redraw();
} else if(this.needsRedraw){ } else if(this.needsRedraw){
this.redraw(); this.redraw();
@ -389,8 +364,6 @@ HuesCanvas.prototype.mixColours = function(percent) {
HuesCanvas.prototype.doXBlur = function() { HuesCanvas.prototype.doXBlur = function() {
this.blurStart = this.aContext.currentTime; this.blurStart = this.aContext.currentTime;
this.trippyStart = this.blurStart;
this.xLast = true;
this.blurDistance = this.blurAmount; this.blurDistance = this.blurAmount;
this.xBlur = true; this.xBlur = true;
this.yBlur = false; this.yBlur = false;
@ -399,8 +372,6 @@ HuesCanvas.prototype.doXBlur = function() {
HuesCanvas.prototype.doYBlur = function() { HuesCanvas.prototype.doYBlur = function() {
this.blurStart = this.aContext.currentTime; this.blurStart = this.aContext.currentTime;
this.trippyStart = this.blurStart;
this.xLast = false;
this.blurDistance = this.blurAmount; this.blurDistance = this.blurAmount;
this.xBlur = false; this.xBlur = false;
this.yBlur = true; this.yBlur = true;

@ -56,7 +56,6 @@ HuesSettings.prototype.defaultSettings = {
autoSongDelay: 5, // loops or minutes depending on autoSong value autoSongDelay: 5, // loops or minutes depending on autoSong value
autoSongShuffle: "on", autoSongShuffle: "on",
autoSongFadeout: "on", autoSongFadeout: "on",
trippyMode: "off",
volume: 0.7 volume: 0.7
}; };
@ -93,8 +92,7 @@ HuesSettings.prototype.settingsCategories = {
"Graphics" : [ "Graphics" : [
"blurAmount", "blurAmount",
"blurDecay", "blurDecay",
"blurQuality", "blurQuality"
"trippyMode"
], ],
"Audio" : [ "Audio" : [
"playBuildups" "playBuildups"
@ -177,10 +175,6 @@ HuesSettings.prototype.settingsOptions = {
autoSongFadeout : { autoSongFadeout : {
name : "AutoSong fade out", name : "AutoSong fade out",
options : ["off", "on"] options : ["off", "on"]
},
trippyMode : {
name : "Trippy Mode",
options : ["off", "on"]
} }
}; };

Loading…
Cancel
Save