Last active
September 9, 2017 17:32
-
-
Save patwooky/040510f53f163393309c2912c88d5178 to your computer and use it in GitHub Desktop.
A PyMel script that creates a twisting line of cubes that gradually gets larger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from pymel.core import * | |
def iterativeFunc(maxNum=20, size=(0.2, 1), rotAngle=(-20, 120)): | |
for n in range(maxNum): | |
myCube = polyCube(ch=False) | |
mySize = [size[0] + ((size[1] - size[0]) /float(maxNum) * n) for x in range(3)] | |
pos = [(size[1]*1.02) * n, 5, 0] | |
rot = [(float(rotAngle[1] - rotAngle[0])/maxNum)*n + rotAngle[0], 0, 0] | |
xform(myCube, t=pos, scale=mySize, rotation=rot) | |
time.sleep(0.01) | |
refresh(force=True) | |
return | |
iterativeFunc(maxNum=80, size=(0.06,2), rotAngle=(120, -120)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymel.core import * | |
import time | |
def recurse(counter, maxCounter): | |
pc = polyCube(ch=False) | |
maxSize = float(1) | |
startSize = float(0.2) | |
sc = (maxSize*startSize) + (maxSize*(1-startSize)/maxCounter)*counter | |
maxRotate = 270 | |
xform(pc, scale=[sc, sc, sc], t=[counter*maxSize*1.005, 0, 0], rotation=[float(maxRotate)/maxCounter*counter, 0, 0] ) | |
time.sleep(0.01) | |
refresh(force=True) | |
if counter >= maxCounter: | |
print counter, maxCounter | |
return | |
print counter | |
recurse(counter+1, maxCounter) | |
return | |
recurse(0, 40) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment