Coding-Challenges icon indicating copy to clipboard operation
Coding-Challenges copied to clipboard

Ascii video example is collapsed by white (255, 255, 255)

Open elzup opened this issue 2 years ago • 0 comments

char index is invalid.

https://editor.p5js.org/codingtrain/sketches/KTVfEcpWx https://github.com/CodingTrain/Coding-Challenges/blob/main/166_Ascii_Image/ascii-video/sketch.js#L36

avg range is 0 <= avg <= 255 if avg is 255 map result equal 1.0 charIndex greater or equal density.length (array out of index).

 const len = density.length;

-      const charIndex = floor(map(avg, 0, 255, 0, len));
+      const charIndex = floor(map(avg, 0, 256, 0, len));
Screenshot 2023-05-15 at 21 43 15

elzup avatar May 15 '23 12:05 elzup