WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   non-linear transformation (https://forum.worldviz.com/showthread.php?t=1301)

jaclyn.bill 01-11-2008 05:43 AM

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

farshizzo 01-11-2008 05:19 PM

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]))


jaclyn.bill 01-22-2008 03:58 AM

thanks for this!

J


All times are GMT -7. The time now is 12:04 AM.

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