WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-11-2008, 05:43 AM
jaclyn.bill jaclyn.bill is offline
Member
 
Join Date: Oct 2007
Posts: 42
non-linear transformation

Dear Users,

I want to change the size of an object using a non-linear function (probably quadratic) over a set period of time - for example, like a balloon inflating which gets quicker towards the end.

Could anyone offer advice on the best way to do this? I'm running a psychology experiment in which this is going to be done many times so I'd like to avoid anything which is computationally slow.

Thank you in advance.

Jaclyn
Reply With Quote
  #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
  #3  
Old 01-22-2008, 03:58 AM
jaclyn.bill jaclyn.bill is offline
Member
 
Join Date: Oct 2007
Posts: 42
thanks for this!

J
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 12:04 PM.


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