Horizontal Matrix rain - color change problem

Hi,

I’ve been learning JS by making some fun with p5.js and I am stuck in one place. I’ve made horizontal matrix rain, then I stuck.

Now: first letter (random generated value) is set to different color than the rest of an array. I want to achieve effect where an array passed half of the display screen width, then colors going to change (reverse).

Any1 had struggle with p5.js before?

IO LINK

When character reaches half of the screen, I want it to change a color (not first one, but every single one). I am trying to make it happen by writing any kind of function. So, confused right now haha. Sorry about that messy talking before.

Assuming you can get at the underlying canvas that p5.js is using, you can use the TextMetrics API.

1 Like