Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
elzup opened this issue May 15, 2023 · 0 comments
Open

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

elzup opened this issue May 15, 2023 · 0 comments

Comments

@elzup
Copy link

elzup commented May 15, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant