Newish to Jitter - 2D text rendering questions - jit.gl.text2d

soulriot's icon

Hi,

I'm trying to make some simple animated text in jitter that is displayed as if it is being entered by hand (eg scanning along a phrase... the rate of change would be consistent, though - I don't need it to feel human). I have been looking at the jit.gl.text2d object, but have been finding it pretty hard going. I tried a couple of approaches - one of these is using a jit.textfile which I labouriously loaded each line with each iteration of a possible text: for example 'H' 'He' 'Hel' 'Hell' 'Hello'. I then scrolled through this using the line object.

This is extremely... inelegant... and with this method I cannot create line-breaks. I was wondering if there was a better way to do this? I feel that there must be a very simple solution to this sort of problem. I am inexperienced with jitter beyond using it for video playback and basic video manipulation, so feel a bit out of my depth. Could anybody shed any light on this?
Jamie

spectro's icon

This turned out to be trickier than I initially thought it would. I started something here but there are still a few issues I couldn't (or don't have time to) resolve - mostly relatd to the limited character count that is successfully captured into the coll from textedit.

Max Patch
Copy patch and select New From Clipboard in Max.

Still, I'm posting it as I went to the effort and it may be of some use to you in developing a (hopefully) better system than what you are currently using. Worse case: you can enter all the data into the coll by hand, but that could be rather tedious...

soulriot's icon

Thank you very much. This is what I was looking for. Yeah... I'm not sure why it can't handle longer texts either. However, I don't have that much text to deal with anyway, so can put it in by hand I think. I suppose for line breaks I could render another instance of it and layer it on top. Thanks.

spectro's icon

Cool. FWIW the jit.gl.2dtext is fed by a jit.matrix which makes that method capable of rendering multiple lines - (just try by entering multiple phrases into the text field one after the other). The thing I didn't do is to handle the text display properly with line breaks etc.

Rob Ramirez's icon

i'm hesitant to post this, because it is absolutely uncommented, but perhaps you will be able to make use of it.
basically, it takes a text file that has paragraphs of text, separated by a blank line, and processes them to be displayed one letter at a time (as if written by someone in real time). it uses jit.gl.text3d in a poly~ object, with a poly~ instance for each line of the display.

in the main patch, you can read in a text file that's in the searchpath, and start outputting the first paragraph by clicking the bang at the top of the patch. also, probably need to send the init bang as well. it assumes the only line-breaks are in between paragraphs in the text file

it uses the jasch externals _ (underscrore, which is prepend set) and strcat.

1906.texttyper.zip
zip
soulriot's icon

Hi. Thanks for your replies. I've been away so haven't had time to look at much of this. I will over the next few days. Thanks again.