Skip to content

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

Open
@elzup

Description

@elzup

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions