From f786d9842b81d8e8959f3e0522306762fed99503 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername Date: Sun, 17 Mar 2024 12:51:06 -0400 Subject: [PATCH] this looks good --- mods/heatglow.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/heatglow.js b/mods/heatglow.js index 3f2cbd6d..99824fb4 100644 --- a/mods/heatglow.js +++ b/mods/heatglow.js @@ -1,3 +1,6 @@ +function weightedAverage(num1, num2, weight){ + return ((weight * num1)+((1-weight)*num2)) +} const heatfunc = function(pixel){ if (pixel.ogR == null || pixel.ogG == null || pixel.ogB == null || !(pixel.element == pixel.ogElement)){ pixel.ogR = parseInt(pixel.color.slice(4, pixel.color.indexOf(',')), 10) @@ -21,7 +24,8 @@ const heatfunc = function(pixel){ pixel.newG = ((510*pixel.ctemp)-255); pixel.newB= ((280*pixel.ctemp)-140); } - pixel.color = "rgb(" + pixel.newR + "," + pixel.newG + "," + pixel.newB + ")"; + let weight = (1-(pixel.ctemp/1.3)) + pixel.color = "rgb(" + weightedAverage(pixel.ogR, pixel.newR, weight) + "," + weightedAverage(pixel.ogG, pixel.newG, weight) + "," + weightedAverage(pixel.ogB, pixel.newB, weight) + ")"; } }; if (!eLists.metals) { eLists.metals = [] } @@ -53,9 +57,6 @@ elements.color_baker = { desc: "Use to bake a metals paint color into its 'true' color, for heating purposes.", } /* -function weightedAverage(num1, num2, weight){ - return ((weight * num1)+((1-weight)*num2)) -} const plantfunc = function(pixel){ if (pixel.ogR == null || pixel.ogG == null || pixel.ogB == null){ pixel.ogR = parseInt(pixel.color.slice(4, pixel.color.indexOf(',')), 10)