TB1 Week 9
The task I had to do this week was to create a Maya window which would allow me to create different objects and animate them in different ways. Which I did with several different functions which would change values and set keyframes every 5 frames.
import maya.cmds
def rotate_animation_X():
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.rotate(90)
cmds.setKeyframe()
cmds.currentTime(10)
cmds.rotate(180)
cmds.setKeyframe()
cmds.currentTime(15)
cmds.rotate(270)
cmds.setKeyframe()
cmds.currentTime(20)
cmds.rotate(360)
cmds.setKeyframe()
def rotate_animation_Y():
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.rotate(0, 90)
cmds.setKeyframe()
cmds.currentTime(10)
cmds.rotate(0, 180)
cmds.setKeyframe()
cmds.currentTime(15)
cmds.rotate(0, 270)
cmds.setKeyframe()
cmds.currentTime(20)
cmds.rotate(0, 360)
cmds.setKeyframe()
def rotate_animation_Z():
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.rotate(0, 0, 90)
cmds.setKeyframe()
cmds.currentTime(10)
cmds.rotate(0, 0, 180)
cmds.setKeyframe()
cmds.currentTime(15)
cmds.rotate(0, 0, 270)
cmds.setKeyframe()
cmds.currentTime(20)
cmds.rotate(0, 0, 360)
cmds.setKeyframe()
def move_animate_X():
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.move(5)
cmds.setKeyframe()
cmds.currentTime(10)
cmds.move(10)
cmds.setKeyframe()
cmds.currentTime(15)
cmds.move(15)
cmds.setKeyframe()
cmds.currentTime(20)
cmds.move(20)
cmds.setKeyframe()
def move_animate_Y():
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.move(0, 5)
cmds.setKeyframe()
cmds.currentTime(10)
cmds.move(0, 10)
cmds.setKeyframe()
cmds.currentTime(15)
cmds.move(0, 15)
cmds.setKeyframe()
cmds.currentTime(20)
cmds.move(0, 20)
cmds.setKeyframe()
def move_animate_Z():
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.move(0, 0, 5)
cmds.setKeyframe()
cmds.currentTime(10)
cmds.move(0, 0, 10)
cmds.setKeyframe()
cmds.currentTime(15)
cmds.move(0, 0, 15)
cmds.setKeyframe()
cmds.currentTime(20)
cmds.move(0, 0, 20)
cmds.setKeyframe()
if cmds.window("Animation_Window", query = True, exists = True):
cmds.deleteUI("Animation_Window", window=True)
My_window = cmds.window("Animation_Window", title="Animation Creator", widthHeight=(200, 200) )
cmds.columnLayout(adjustableColumn=True)
cmds.button( label='Create Cube', command = "cmds.polyCube()")
cmds.button( label="Create Cylinder", command = "cmds.polyCylinder()")
cmds.button( label="Create Torus", command = "cmds.polyTorus()")
cmds.button( label="Animate X Rotation", command = "rotate_animation_X()")
cmds.button( label="Animate Y Rotation", command = "rotate_animation_Y()")
cmds.button( label="Animate Z Rotation", command = "rotate_animation_Z()")
cmds.button( label="Animate X Movement", command = "move_animate_X()")
cmds.button( label="Animate Y Movement", command = "move_animate_Y()")
cmds.button( label="Animate Z Movement", command = "move_animate_Z()")
cmds.setParent('..')
cmds.showWindow("Animation_Window")
Programming for Animation Devblog
Status | Prototype |
Category | Other |
Author | Pomanchocho |
More posts
- TB1 Week 10Dec 05, 2022
- TB1 Week 8Dec 05, 2022
- TB1 Week 7Dec 05, 2022
- TB1 Week 6Dec 05, 2022
- TB1 Week 5Dec 05, 2022
- TB1 Week 4Dec 05, 2022
- TB1 Week 3Dec 05, 2022
- TB1 Week 2Dec 05, 2022
Leave a comment
Log in with itch.io to leave a comment.