WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-11-2008, 06: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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:54 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC