This commit is contained in:
Laetitia (O-01-67) 2023-01-24 13:39:29 -05:00 committed by GitHub
parent 7cbb19573f
commit 3a9efd6da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 98 additions and 97 deletions

View File

@ -1,29 +1,26 @@
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";
stripeFixedDefaultProperties = {
if(enabledMods.includes(libraryMod)) {
stripeFixedDefaultProperties = {
color2: "rgb(0,0,0)",
phase: 0,
scale: 1,
angle: 0
};
};
stripeSpreadingProperties = {
stripeSpreadingProperties = {
color1: "It doesn't matter what I put here; I'm just sick of writing for loops.",
color2: "stan loona",
};
};
/*stripeSpreadingProperties2 = {
/*stripeSpreadingProperties2 = {
phase: 0,
scale: 1, :eggTF:
angle: 0
};*/
};*/
function stripeFunction(pixel) {
function stripeFunction(pixel) {
if(pixel.color1 == undefined || pixel.color1 == null) {
pixel.color1 = pixel.color;
};
@ -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,32 +56,32 @@ 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]);
};
pixel.color = convertColorFormats(preColor,"rgb");
};
};
stripePaintDesc = `Exactly what it says on the button.
<br/>
Properties: <ol>
<li>color1: The first color of the stripe</li>
<li>color2: The second color of the stripe (defaults to black)</li>
<li>scale: Relative width of the stripes, compared to the default</li>
<li>phase: Offset in the position of the stripes (π/2 = 1 stripe width)</li>
<li>angle: Angle in degrees<ul>
stripePaintDesc = `Exactly what it says on the button.
<br/>
Properties: <ol>
<li>color1: The first color of the stripe</li>
<li>color2: The second color of the stripe (defaults to black)</li>
<li>scale: Relative width of the stripes, compared to the default</li>
<li>phase: Offset in the position of the stripes (π/2 = 1 stripe width)</li>
<li>angle: Angle in degrees<ul>
<li>0 = vertical line</li>
<li>45 = bottom left to top right</li>
<li>90 = horizontal line</li>
<li>135 = top left to bottom right...</li>
</ul></li></ol>
</ul></li></ol>
color1 and color2 spread through striped paint like dye does with itself. <u>color1</u> can be set <em>on initial placement</em> through the color picker, but otherwise, properties must be changed through the console or with prop.js's tools.
color1 and color2 spread through striped paint like dye does with itself. <u>color1</u> can be set <em>on initial placement</em> through the color picker, but otherwise, properties must be changed through the console or with prop.js's tools.
<small><em style="color: #ff5555;">This does not work with HSL color and the game will black screen if one is somehow used.</em> The color conversion functions are a clusterf***.</small>`
<small><em style="color: #ff5555;">This does not work with HSL color and the game will black screen if one is somehow used.</em> The color conversion functions are a clusterf***.</small>`
elements.stripe_paint = {
elements.stripe_paint = {
behavior: behaviors.LIQUID,
state: "liquid",
density: 998,
@ -105,5 +102,9 @@ elements.stripe_paint = {
stripeFunction(pixel);
},
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));
};