I’m trying to write an expression to do per-character text animation in Natron (you may remember I did this recently).
In my expression I have a bit of code to offset the animation by 15 frames and now I’m trying to slow it down (usually one character appears per frame). Here’s my code:
text = Source.text.get() letter= 0 # what frame to start triggering the write-on effect trigger = 15 # this should ensure that the text, regardless of size, fits within 25 frames speed = len(text)/25 if frame >= trigger: letter =ceil((letter-trigger)/speed) ret= text[:letter]
I learnt that frame number must be integers and so I’m using
ceil to round up the number to the nearest integer but I’m getting the following error.
ERROR: While executing script: ret = app1.Text1.text.expression0(16, 0) Python error: Python exception: integer division or modulo by zero Traceback (most recent call last): File "<string>", line 1, in <module> File "<string>", line 38, in expression0 ZeroDivisionError: integer division or modulo by zero
I tried this script out in regular desktop Python 3 (substituted
frame for an integer) and it worked fine but for some reason it’s not working in Natron.
example_expression.ntp (44.4 KB)