From f8fc66247f2c678b3041e2da18724f699f68cfd2 Mon Sep 17 00:00:00 2001 From: brianharvey Date: Thu, 22 Apr 2021 21:55:31 -0700 Subject: [PATCH] fix negative color effect in objects.js In JS, foo%360 gives a negative remainder if the dividend is negative. This one-line change from developer.mozilla.org computes the correct modulo. I should have called this branch "color" not "ghost", oops. --- src/objects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects.js b/src/objects.js index b47ed3bd..bb1b6678 100644 --- a/src/objects.js +++ b/src/objects.js @@ -5113,7 +5113,7 @@ SpriteMorph.prototype.applyGraphicsEffects = function (canvas) { } v = max / 255; - h = (h + hueShift * 360 / 200) % 360; + h = (((h + hueShift * 360 / 200) % 360)+360)%360; s = Math.max(0, Math.min(s + saturationShift / 100, 1)); v = Math.max(0, Math.min(v + brightnessShift / 100, 1));