lib dep
This commit is contained in:
parent
7cbb19573f
commit
3a9efd6da4
|
|
@ -1,10 +1,7 @@
|
|||
function averageColors(color1,color2,outputType="rgb",weight1=0.5) {
|
||||
color1 = convertColorFormats(color1,"json");
|
||||
color2 = convertColorFormats(color2,"json");
|
||||
theColor = averageColorObjects(color1,color2,weight1);
|
||||
return convertColorFormats(theColor,outputType);
|
||||
};
|
||||
var modName = "mods/color_tools.js";
|
||||
var libraryMod = "mods/code_library.js";
|
||||
|
||||
if(enabledMods.includes(libraryMod)) {
|
||||
stripeFixedDefaultProperties = {
|
||||
color2: "rgb(0,0,0)",
|
||||
phase: 0,
|
||||
|
|
@ -43,7 +40,7 @@ function stripeFunction(pixel) {
|
|||
var otherPixel = pixelMap[x][y];
|
||||
for(prop in stripeSpreadingProperties) {
|
||||
if(otherPixel.element == pixel.element && pixel[prop] && otherPixel[prop]) {
|
||||
otherPixel[prop] = averageColors(pixel[prop],otherPixel[prop]);
|
||||
otherPixel[prop] = lerpColors(pixel[prop],otherPixel[prop]);
|
||||
};
|
||||
};
|
||||
/*for(prop in stripeSpreadingProperties2) {
|
||||
|
|
@ -59,7 +56,7 @@ function stripeFunction(pixel) {
|
|||
|
||||
var sineWeight = (1+Math.sin(pixel.phase + colorNumber / pixel.scale))/2;
|
||||
|
||||
var preColor = averageColors(pixel.color1,pixel.color2,"json",sineWeight);
|
||||
var preColor = lerpColors(pixel.color1,pixel.color2,"json",sineWeight);
|
||||
for(colorlet in preColor) {
|
||||
preColor[colorlet] = Math.round(preColor[colorlet]);
|
||||
};
|
||||
|
|
@ -106,4 +103,8 @@ elements.stripe_paint = {
|
|||
},
|
||||
desc: stripePaintDesc
|
||||
};
|
||||
|
||||
} else {
|
||||
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
|
||||
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
|
||||
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue