View Single Post
  #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