nondescript changes
This commit is contained in:
parent
6b3f8894c1
commit
22c9701faf
|
|
@ -128,6 +128,32 @@
|
|||
return typeof(elements[elementName]) === "object";
|
||||
};
|
||||
|
||||
//Has a given state
|
||||
function isState(elementName,inputState) {
|
||||
if(!elementExists(elementName)) {
|
||||
throw new Error(`Element ${elementName} doesn't exist`);
|
||||
};
|
||||
|
||||
var infoState = elements[elementName].state;
|
||||
|
||||
if(infoState == undefined) { infoState = "undefined" };
|
||||
|
||||
if(inputState == undefined) { inputState = "undefined" };
|
||||
if(inputState instanceof Array) {
|
||||
var limit = 0;
|
||||
while(inputState.includes(undefined) && limit < 3) {
|
||||
inputState[inputState.indexOf(undefined)] = "undefined"
|
||||
limit++;
|
||||
};
|
||||
};
|
||||
|
||||
if(inputState instanceof Array) {
|
||||
return inputState.includes(infoState);
|
||||
};
|
||||
|
||||
return infoState == inputState;
|
||||
};
|
||||
|
||||
//Check if pixel of given element exists at given location
|
||||
function hasPixel(x,y,elementInput) {
|
||||
if(isEmpty(x,y,true)) { //if empty, it can't have a pixel
|
||||
|
|
@ -1012,9 +1038,10 @@
|
|||
return convertHslObjects(color,outputType);
|
||||
};
|
||||
|
||||
function colorToHsl(color,outputType) {
|
||||
function colorToHsl(color,outputType="rgb") {
|
||||
color = convertColorFormats(color,"rgb");
|
||||
color = rgbStringToHSL("color",)
|
||||
color = rgbStringToHSL(color,outputType);
|
||||
return color;
|
||||
};
|
||||
|
||||
//https://stackoverflow.com/questions/36721830/convert-hsl-to-rgb-and-hex
|
||||
|
|
@ -1229,6 +1256,16 @@
|
|||
};
|
||||
};
|
||||
|
||||
function isOpenAndOnSurface(x,y,includeBottomBound=true) {
|
||||
if(!isEmpty(x,y,false)) {
|
||||
return false;
|
||||
};
|
||||
if(y + 1 == height) {
|
||||
return includeBottomBound;
|
||||
};
|
||||
return !isEmpty(x,y+1,true);
|
||||
};
|
||||
|
||||
//Logic
|
||||
|
||||
function xor(c1,c2) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue