Best Way to Read from .txt and draw animated letters?
I'm interested in a patch that reads text from a text file (at a certain rate), and then places each letter on screen (with an effect)...I have a proof of concept patch that reads from a .txt and places the letters in a zoom down effect...the letters then drop down out of the screen...
I'm using a jit.gl.3dtext for EACH letter as I want them to zoom in separately. Will that be efficient enough? 46 Letters fit across the screen, and if I wanted to have multiple lines that would be 46*15 gl.3dtexts
Is there something better than this? It's very tedious to create that many patchers and stuff...
Motivation for this: http://www.vimeo.com/2885437
I know what I have is a p.o.s compared to this, but maybe eventually I want to implement more complicated flocking movement or something...I don't think the patch right now is very expandable
Any ideas?
poly~ will most certainly be your friend in this case. number of voices will be the maximum number of letters you will have active at one time.
i also recommend enabling matrixoutput on your text3d, and banging it in to a gl.mesh every time you change your letter (not every frame). gl.mesh is more efficient and more flexible. however, you have to be careful with you font selection. serif fonts create more polygons. depth also creates more polygons and should be avoided if possible.
a basic example of what your poly might contain. to change the letter, send the list "text a"(or whatever your letter is) to the right input.
you can also utilize something like p.shiva/vishnu, or jit.boids3d to control the position of each letter. each frame you would use jit.iter over the position matrix, and send the position values to corresponding target voices in your poly~.
last tip. jit.textfile might be more convenient and flexible than text.
Thanks, I will look into poly (I have always delayed using poly) and post some tests here.
Ok here is what I have so far, the poly~ is definitely easier on the coding, and I am using a coll to store the positions of each letter (only enabled 26 for testing purposes). A few questions:
1) Should I be using coll? I ask this bcs in the future I may want to implement using boids to control the position of each letter.
2) Is there anyway to make the letters spaced better? This has to take into account capital letter or not, and also skinny letters like i and j. Type in the capital alphabet into the text box and bang it, then hit the GO button...the spacing is very different than typing in the lowercase alphabet (obviously)...do I just need to have different colls to parse skinny and lowercase letters and stuff? Or is there an easier way in jitter to make text behave nicely.
*open the mk_text_reader_poly patch
Because gl.mesh can't render "spaces" correctly, Im just opting to use the .text3d
I have attached what I have so far with my patch. Where can I optimize this? When the letters drop down to -inf their movement is slightly choppy.
Any suggestion or comments on what I have?