Skip to content
Advertisement

Scrolling text effect on 2D array

For a project I am working on I would like to be abbe to “scroll” an array like so: example of "scrolling" effect

Here is the code I have so far:

JavaScript

The code I have is effective up until the the array needs to “wrap around” to the other side. Where have I gone wrong?

Advertisement

Answer

I’m assuming that you’re looking for a formula that would work for the else. Usually Modulos are very helpful for wrapping around. What you are looking for is basically

JavaScript

which works even when it’s not wrapped around.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement