Skip to content

Commit ae34d66

Browse files
authored
Change rounding to flooring for color calculations
1 parent 65320d9 commit ae34d66

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cnn/cnn2.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,27 +221,27 @@ function drawFractal() {
221221
color = `hsl(${v * 360},100%,50%)`;
222222
}
223223
else if (mode === "binary") {
224-
const s = Math.round(raw);
224+
const s = Math.floor(raw);
225225
const r = ((s % 2) + 2) % 2;
226226
color = (r === 0) ? "#000" : "#fff";
227227
}
228228
else if (mode === "rgb") {
229-
const s = Math.round(raw);
229+
const s = Math.floor(raw);
230230
const p = ["#f00", "#0f0", "#00f"];
231231
color = p[((s % 3) + 3) % 3];
232232
}
233233
else if (mode === "mod4") {
234-
const s = Math.round(raw);
234+
const s = Math.floor(raw);
235235
const r = ((s % 4) + 4) % 4;
236236
color = (r === 0 || r === 1) ? "#000" : "#fff";
237237
}
238238
else if (mode === "livingstone") {
239-
const s = Math.round(raw);
239+
const s = Math.floor(raw);
240240
const p = ["#000", "#5f5", "#f55", "#ff5"];
241241
color = p[((s % 4) + 4) % 4];
242242
}
243243
else if (mode === "alleycat") {
244-
const s = Math.round(raw);
244+
const s = Math.floor(raw);
245245
const p = ["#000", "#5ff", "#f5f", "#fff"];
246246
color = p[((s % 4) + 4) % 4];
247247
}

0 commit comments

Comments
 (0)