Any way to auto-scroll text?

I have a sketch where I'm constantly adding to a string that is displayed in a text box the size for the full canvas, and i'd like for when the string gets larger than can fit in the box to scroll down to the un-shown text or just remove text from the beginning until the whole thing fits. Any strategies for this? Is there perhaps an event that fires when the string is too big to fit in the box?

Tagged:

Answers

  • I'd just count the line breaks in the text and strip out the first line once the maximum is exceeded. Not sure if p5js has tools that will do this directly, but JS replace() supports regular expressions.

    You'd obviously have to figure out the max but that's a one off and if need be could probably be calculated programmatically...

Sign In or Register to comment.