View Single Post
  #2  
Old 01-11-2008, 05:19 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is a sample script that uses cubic interpolation to resize a ball. The animations will start slow and speed up to the end. You can tweak the p1 and p2 parameters of the vizact.sizeTo() command to adjust the midpoints of the cubic spline. Run the script and press the spacebar to toggle between growing and shrinking the ball.
Code:
import viz
viz.go()

ball = viz.add('ball.wrl',pos=(0,1.8,3))

growAction = vizact.sizeTo([4,4,4],time=1,p1=0.0,p2=0.1)
shrinkAction = vizact.sizeTo([1,1,1],time=1,p1=0.0,p2=0.1)

vizact.onkeydown(' ',ball.runAction,vizact.choice([growAction,shrinkAction]))
Reply With Quote