WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-21-2008, 10:50 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is some sample code that uses the vizact library to create an action that does what you want.
Code:
import viz
viz.go()

#Create quad for displaying texture
quad = viz.addTexQuad(pos=(0,1.8,2))

#List of texture filenames
files = ['ball.jpg','gb_noise.jpg','brick.jpg','lake3.jpg']

#List of texture objects
textures = [ viz.addTexture(f) for f in files ]

#Create action that randomly waits between 2-6 seconds
waitTime = vizact.waittime( vizact.randfloat(2.0,6.0) )

#Create action that randomly applies texture from list above
randomTexture = vizact.texture_node( vizact.choice(textures,vizact.RANDOM) )

#Create sequence that repeats above actions indefinitely
my_action = vizact.sequence( waitTime, randomTexture, viz.FOREVER )

#Add action to quad
quad.addAction(my_action)
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 02:24 PM.


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