parent
c349fc229d
commit
ea2780573c
|
|
@ -9,6 +9,10 @@ function rgbColorBound(number) {
|
||||||
return Math.min(255,Math.max(0,number));
|
return Math.min(255,Math.max(0,number));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function slBound(number) {
|
||||||
|
return Math.min(100,Math.max(0,number));
|
||||||
|
};
|
||||||
|
|
||||||
elements.creeper = {
|
elements.creeper = {
|
||||||
color: ["#D2D2D2", "#BFDFB9", "#94CE89", "#78D965", "#5ED54C", "#58C546", "#50B143", "#479143", "#559552", "#3F8738", "#5B8B59"],
|
color: ["#D2D2D2", "#BFDFB9", "#94CE89", "#78D965", "#5ED54C", "#58C546", "#50B143", "#479143", "#559552", "#3F8738", "#5B8B59"],
|
||||||
category: "life",
|
category: "life",
|
||||||
|
|
@ -160,7 +164,7 @@ elements.creeper_body = {
|
||||||
if(!pixel.didChargeBlueTinted) { //do once, on initial charge
|
if(!pixel.didChargeBlueTinted) { //do once, on initial charge
|
||||||
//console.log("something something halsey lyric");
|
//console.log("something something halsey lyric");
|
||||||
var color = pixel.color;
|
var color = pixel.color;
|
||||||
if(color.startsWith("rgb")) { //too dumb to do equivalent HSL math
|
if(color.startsWith("rgb")) {
|
||||||
//console.log("rgb detected");
|
//console.log("rgb detected");
|
||||||
color = color.split(","); //split color for addition
|
color = color.split(","); //split color for addition
|
||||||
var red = parseFloat(color[0].substring(4));
|
var red = parseFloat(color[0].substring(4));
|
||||||
|
|
@ -172,6 +176,25 @@ elements.creeper_body = {
|
||||||
color = `rgb(${red},${green},${blue})`;
|
color = `rgb(${red},${green},${blue})`;
|
||||||
pixel.color = color;
|
pixel.color = color;
|
||||||
//console.log("color set");
|
//console.log("color set");
|
||||||
|
} else if(color.startsWith("hsl")) {
|
||||||
|
//console.log("hsl detected");
|
||||||
|
color = color.split(","); //split color for addition
|
||||||
|
var hue = parseFloat(color[0].substring(4));
|
||||||
|
var saturation = parseFloat(color[1].slice(0,-1));
|
||||||
|
var luminance = parseFloat(color[2].slice(0,-2));
|
||||||
|
hue = hue % 360; //piecewise hue shift
|
||||||
|
if(hue <= 235 && hue >= 135) {
|
||||||
|
hue = 185;
|
||||||
|
} else if(hue < 135) {
|
||||||
|
hue += 50;
|
||||||
|
} else if(hue > 235 && hue < 360) {
|
||||||
|
hue -= 50;
|
||||||
|
};
|
||||||
|
saturation = slBound (saturation + 10);
|
||||||
|
luminance = slBound(luminance + 20);
|
||||||
|
color = `hsl(${hue},${saturation}%,${luminance}%)`;
|
||||||
|
pixel.color = color;
|
||||||
|
//console.log("color set");
|
||||||
};
|
};
|
||||||
pixel.didChargeBlueTinted = true;
|
pixel.didChargeBlueTinted = true;
|
||||||
};
|
};
|
||||||
|
|
@ -208,7 +231,7 @@ elements.creeper_body = {
|
||||||
//Color code {
|
//Color code {
|
||||||
var ticksHissing = pixelTicks - head.hissStart;
|
var ticksHissing = pixelTicks - head.hissStart;
|
||||||
var color = pixel.color; //do on each hissing tick
|
var color = pixel.color; //do on each hissing tick
|
||||||
if(color.startsWith("rgb")) { //too dumb to do equivalent HSL math
|
if(color.startsWith("rgb")) {
|
||||||
//console.log("rgb detected");
|
//console.log("rgb detected");
|
||||||
color = color.split(","); //split color for addition
|
color = color.split(","); //split color for addition
|
||||||
var red = parseFloat(color[0].substring(4));
|
var red = parseFloat(color[0].substring(4));
|
||||||
|
|
@ -220,6 +243,18 @@ elements.creeper_body = {
|
||||||
color = `rgb(${red},${green},${blue})`;
|
color = `rgb(${red},${green},${blue})`;
|
||||||
pixel.color = color;
|
pixel.color = color;
|
||||||
//console.log("color set");
|
//console.log("color set");
|
||||||
|
} else if(color.startsWith("hsl")) {
|
||||||
|
//console.log("hsl detected");
|
||||||
|
color = color.split(","); //split color for addition
|
||||||
|
var hue = parseFloat(color[0].substring(4));
|
||||||
|
var saturation = parseFloat(color[1].slice(0,-1));
|
||||||
|
var luminance = parseFloat(color[2].slice(0,-2));
|
||||||
|
//console.log("the j");
|
||||||
|
luminance = slBound(luminance + 1.176);
|
||||||
|
//console.log(luminance);
|
||||||
|
color = `hsl(${hue},${saturation}%,${luminance}%)`;
|
||||||
|
pixel.color = color;
|
||||||
|
//console.log("color set");
|
||||||
};
|
};
|
||||||
//}
|
//}
|
||||||
};
|
};
|
||||||
|
|
@ -323,7 +358,7 @@ elements.creeper_head = {
|
||||||
if(!pixel.didChargeBlueTinted) { //do once, on initial charge
|
if(!pixel.didChargeBlueTinted) { //do once, on initial charge
|
||||||
//console.log("something something halsey lyric");
|
//console.log("something something halsey lyric");
|
||||||
var color = pixel.color;
|
var color = pixel.color;
|
||||||
if(color.startsWith("rgb")) { //too dumb to do equivalent HSL math
|
if(color.startsWith("rgb")) {
|
||||||
//console.log("rgb detected");
|
//console.log("rgb detected");
|
||||||
color = color.split(","); //split color for addition
|
color = color.split(","); //split color for addition
|
||||||
var red = parseFloat(color[0].substring(4));
|
var red = parseFloat(color[0].substring(4));
|
||||||
|
|
@ -335,6 +370,25 @@ elements.creeper_head = {
|
||||||
color = `rgb(${red},${green},${blue})`;
|
color = `rgb(${red},${green},${blue})`;
|
||||||
pixel.color = color;
|
pixel.color = color;
|
||||||
//console.log("color set");
|
//console.log("color set");
|
||||||
|
} else if(color.startsWith("hsl")) {
|
||||||
|
//console.log("hsl detected");
|
||||||
|
color = color.split(","); //split color for addition
|
||||||
|
var hue = parseFloat(color[0].substring(4));
|
||||||
|
var saturation = parseFloat(color[1].slice(0,-1));
|
||||||
|
var luminance = parseFloat(color[2].slice(0,-2));
|
||||||
|
hue = hue % 360; //piecewise hue shift
|
||||||
|
if(hue <= 235 && hue >= 135) {
|
||||||
|
hue = 185;
|
||||||
|
} else if(hue < 135) {
|
||||||
|
hue += 50;
|
||||||
|
} else if(hue > 235 && hue < 360) {
|
||||||
|
hue -= 50;
|
||||||
|
};
|
||||||
|
saturation = slBound (saturation + 10);
|
||||||
|
luminance = slBound(luminance + 20);
|
||||||
|
color = `hsl(${hue},${saturation}%,${luminance}%)`;
|
||||||
|
pixel.color = color;
|
||||||
|
//console.log("color set");
|
||||||
};
|
};
|
||||||
pixel.didChargeBlueTinted = true;
|
pixel.didChargeBlueTinted = true;
|
||||||
};
|
};
|
||||||
|
|
@ -445,7 +499,7 @@ elements.creeper_head = {
|
||||||
//Color code {
|
//Color code {
|
||||||
var ticksHissing = pixelTicks - pixel.hissStart;
|
var ticksHissing = pixelTicks - pixel.hissStart;
|
||||||
var color = pixel.color; //do on each hissing tick
|
var color = pixel.color; //do on each hissing tick
|
||||||
if(color.startsWith("rgb")) { //too dumb to do equivalent HSL math
|
if(color.startsWith("rgb")) {
|
||||||
//console.log("rgb detected");
|
//console.log("rgb detected");
|
||||||
color = color.split(","); //split color for addition
|
color = color.split(","); //split color for addition
|
||||||
var red = parseFloat(color[0].substring(4));
|
var red = parseFloat(color[0].substring(4));
|
||||||
|
|
@ -457,6 +511,16 @@ elements.creeper_head = {
|
||||||
color = `rgb(${red},${green},${blue})`;
|
color = `rgb(${red},${green},${blue})`;
|
||||||
pixel.color = color;
|
pixel.color = color;
|
||||||
//console.log("color set");
|
//console.log("color set");
|
||||||
|
} else if(color.startsWith("hsl")) {
|
||||||
|
//console.log("hsl detected");
|
||||||
|
color = color.split(","); //split color for addition
|
||||||
|
var hue = parseFloat(color[0].substring(4));
|
||||||
|
var saturation = parseFloat(color[1].slice(0,-1));
|
||||||
|
var luminance = parseFloat(color[2].slice(0,-2));
|
||||||
|
luminance = slBound(luminance + 1.176);
|
||||||
|
color = `hsl(${hue},${saturation}%,${luminance}%)`;
|
||||||
|
pixel.color = color;
|
||||||
|
//console.log("color set");
|
||||||
};
|
};
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue