Need help: Dynamic text animation
-
Ok so my problem is:
I would like to make an animation based of an animation I already have.
So i made this small gif,
and here is the code.import random w = 1920 h = 1080 rows = 7 cols = 13 range_ = 20 fs = 60 duration = .4 for frame in range(range_): newPage(w, h) frameDuration(duration) fontSize(fs) for currentCol in range(cols): dotSize = w /(cols + (cols+1)) x = dotSize + currentCol*(dotSize + dotSize) for currentRow in range(rows): y = dotSize + currentRow*(dotSize + dotSize) if random.random() > 0.5: fill(0.9, 0, 1) textBox('É', (x, y, dotSize, dotSize)) else: fill(0.1, 0, 1) textBox('e', (x, y, dotSize, dotSize)) # saveImage('/Desktop/Grid_letters_3.gif')
Anyway it gave me an idea of making another animation based of this one, but where the letters don't switch randomly, but where text is coming from left to right, with some "ascii" letters, something like this. (but instead of orange dots, purple letters, and the blue letters are the "background")
I hope I have made myself clear, sorry if I have not.
I'm writing this post bc I have absolutely no idea of how I could make this work, so I'm throwing a bottle into the sea.
Thanks in advance!
-
Do you mean something like this?
w = 1920 h = 1080 columns = 13 spacing = w/(columns+1) fs = 60 duration = .25 txt = 'ABCD' frames = columns+len(txt)+1 for frame in range(frames): newPage(w, h) frameDuration(duration) fontSize(fs) # white background with savedState(): fill(1) rect(0,0,w,h) for column in range(columns): x = spacing + column * spacing # Use the frame count as starting position for the text. # frame-len(txt) makes sure the start of the text is outside the row of characters if column >= frame-len(txt) and column < frame: # txt[0] gets the first character, A, txt[1] gets the second, etc. # txt[column-frame] makes sure the range alway stays between 0 and the length of the text, # as the length of frames is defined by columns+len(txt)+1. text(txt[column-frame], (x, h/2), align='center') else: # If the column position is not between frame-len(txt) and frame, use a dot. # You could add random characters here. text('.', (x, h/2), align='center') saveImage('abcd.gif')
-
You could combine that with bitmapFont-Drawbot.py from Connor Davenport, which will give you something like this:
-
@monomonnik said in Need help: Dynamic text animation:
Thank you man! Helped a lot