from TSsupport import rand, randint import trueSpace import time doc = trueSpace.GetActiveDocument() doc.ClearOutTxt() # plan # start at 90 count down to zero # create objects min0 to min4, tsec0 to tsec5, and usec0 to usec9 # min is minutes, tsec is tens of seconds and usec is seconds less than ten # min0, tsec0, usec0 would each be a copy of a zero text # min1, tsec1, usec1 are copies of the one text # # keyframe visibility from python not work so use position keys # # set extra frames to sharpen transition # otherwise get smooth motion that would be visible # function def def MoveitIn(MyObject,MyPosn,MyFrame,OutPosn): doc.ActiveTime = MyFrame - 2 MyObject.Position = OutPosn MyObject.SetFrame() doc.ActiveTime = MyFrame - 1 MyObject.Position = OutPosn MyObject.SetFrame() doc.ActiveTime = MyFrame MyObject.Position = MyPosn MyObject.SetFrame() doc.ActiveTime = MyFrame + 1 MyObject.Position = MyPosn MyObject.SetFrame() doc.ActiveTime = MyFrame + 2 MyObject.Position = MyPosn MyObject.SetFrame() def MoveitOut(MyObject,MyPosn,MyFrame,OutPosn): doc.ActiveTime = MyFrame - 2 MyObject.Position = MyPosn MyObject.SetFrame() doc.ActiveTime = MyFrame - 1 MyObject.Position = MyPosn MyObject.SetFrame() doc.ActiveTime = MyFrame MyObject.Position = MyPosn MyObject.SetFrame() doc.ActiveTime = MyFrame + 1 MyObject.Position = OutPosn MyObject.SetFrame() doc.ActiveTime = MyFrame + 2 MyObject.Position = OutPosn MyObject.SetFrame() # 90 sec = 1:30 # move start 1 second from zero time # out position is out of screen position waiting area theoutposn = (0,0,-10) numsecs = 90 # get start sec, tsec, min and move into position cdtext = numsecs mytimetuple = time.gmtime(cdtext) myseconds = time.strftime ('%S', mytimetuple) pusec = myseconds[1] objname = "usec" + pusec thedigit = doc.Object(objname) theposition = (0,0,1) theframe = 30 MoveitIn(thedigit,theposition,theframe,theoutposn) myseconds = time.strftime ('%S', mytimetuple) ptsec = myseconds[0] objname = "tsec" + ptsec thedigit = doc.Object(objname) theposition = (1.8,-1.8,1) theframe = 30 MoveitIn(thedigit,theposition,theframe,theoutposn) myseconds = time.strftime ('%M', mytimetuple) pmin = myseconds[1] objname = "min" + pmin thedigit = doc.Object(objname) theposition = (4.7,-4.7,1) theframe = 30 MoveitIn(thedigit,theposition,theframe,theoutposn) for mytime in range(0,numsecs): theframe = 30*(mytime + 1) cdtext = numsecs-mytime doc.ActiveTime = theframe mytimetuple = time.gmtime(cdtext) myseconds = time.strftime ('%S', mytimetuple) usec = myseconds[1] theposition = (0,0,1) if usec != pusec: objname = "usec" + usec thedigit = doc.Object(objname) MoveitIn(thedigit,theposition,theframe,theoutposn) objname = "usec" + pusec thedigit = doc.Object(objname) MoveitOut(thedigit,theposition,theframe,theoutposn) pusec = usec tsec = myseconds[0] theposition = (1.8,-1.8,1) if tsec != ptsec: objname = "tsec" + tsec thedigit = doc.Object(objname) MoveitIn(thedigit,theposition,theframe,theoutposn) objname = "tsec" + ptsec thedigit = doc.Object(objname) MoveitOut(thedigit,theposition,theframe,theoutposn) ptsec = tsec myseconds = time.strftime ('%M', mytimetuple) min = myseconds[1] theposition = (4.7,-4.7,1) if min != pmin: objname = "min" + min thedigit = doc.Object(objname) MoveitIn(thedigit,theposition,theframe,theoutposn) objname = "min" + pmin thedigit = doc.Object(objname) MoveitOut(thedigit,theposition,theframe,theoutposn) pmin = min trueSpace.Stop()