Python Update: How to Animate Text in Blender


I’m generally opposed to functions that overload on parameters. But seeing as how Blender functions do it all the time, I figured I’d go nuts for this updated text animation function.

So What’s New?

The first time around, I added if clauses to account for the different sizes of the letters because I am 36 times an idiot (yes, I’m six hours into a Poirot binge). Blender has object dimensions that you can call as variables. That’ll tell you how far over you need to move each character to make the letters readable. That’s this guy by the way:


Adding that shortened my first version considerably.

Onto the parameters! I want to be able to set the start location, end location, start frame, end frame of the first object, frame increment, start rotation, and end rotation. Since locations and rotations all have three values for the x, y, and z axis, this is ever so slightly busy. But cool because you can customize the hell out of it.

Here’s the breakdown.

Code ExplainedChange up the parameters to get different effects. Rotation, sliding about, or some combination of the two.

Once Upon A Time

The Code

import bpy

#tx = start x, ty = start y, tz=start z
#ex = offset x, ey = offset y, ez = offset z
#sf = start frame of all letters
#ef = first letter stop frame
#inc = frame increment
def movetext(string, tx, ty, tz, ex, ey, ez, sf, ef, inc, sxr, syr, szr, exr, eyr, ezr):
sl = list(string)
while x < len(sl):
bpy.ops.object.text_add(location=(tx,ty,tz), rotation=(sxr,syr,szr))
ob=bpy.context.object = sl[x]
ob.keyframe_insert(data_path="rotation_euler", frame=sf)
ob.location.x = ex + tx
ob.location.y = ey + ty
ob.location.z = ez + tz
ob.rotation_euler=[exr, eyr, ezr]
ob.keyframe_insert(data_path="rotation_euler", frame=ef)
ef += inc
tx = tx + bpy.context.object.dimensions.x

movetext("Eat-Sleep-Rave-Repeat", 1, 10, 0, 2, -10, 0, 0, 2, 8, 0, 0, 0, 1.57, 0, 0)


Tagged , , , , , , ,

4 thoughts on “Python Update: How to Animate Text in Blender

  1. ARJ says:

    weird question

    but to make this script execute in blender?

    meaning where?

    Liked by 1 person

  2. TimothyFEALS says:

    buy windows 7 download for mac best price windows 7 professional Maxon Cinema 4D Studio R17 adobe premiere elements 11 tutorial purchase photoshop cs6 mac


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: