Python Studies 04: Matrix Animation

Table of Contents


  • This project is an extension of the Python Matrix project. 
  • The goal is produce a 10 second animation of demo-reel quality.


In order to add more details for each petal in each ring, I made use of aim and parent constraints targeted at two separate locators. The aimConstraint allows me to orient the objects to point towards a target, and the parentConstraint is responsible for animating the ring position and animation, and most importantly, radially scale the ring without affecting the scale of the objects.

With that concept, the next step to make things more efficient with Python, and here are the steps I taken to animate the Matrix:

  • Set the anchor points to the bottom for each ring, and zero out the translateY.
  • In order to select children of a group and apply the constraints to each petal individually, I made use of the code below to automate the process.
  • Animate the first set of locators
  • Duplicate special the animated locators
  • Repeat step 1 and 2 for rest of the rings with the duplicated locators
  • Reposition the rings in place and edit scale values accordingly
					import maya.cmds as cmds
n =
bbox = cmds.exactWorldBoundingBox(n)
bottom = [(bbox[0] + bbox[3])/2, bbox[1], (bbox[2] + bbox[5])/2]
cmds.xform(n, piv=bottom, ws=True)
					import maya.cmds as cmds

# select children of selected group
sel =
ch = cmds.listRelatives(sel)

# specify null names
n = '1'
myParent = 'null_parent'+n
myAim = 'null_aim'+n

# apply constraints
for n in range(len(ch)):
    cmds.parentConstraint(myParent,ch[n], mo=True,sr=["x","y","z"])


For most of my digital media career, I often tell myself that I was not good at 3D software or methodology, but this project and class really allowed to overcome that. I found myself comfortable animating this scene in Maya using the Camera Sequencer and Graph Editor much like what I do in After Effects. Though some parts could have been better but I believe this year is when my 3D skills start to bloom and allowing me to create things I never could before!