WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-23-2009, 07:31 AM
tomo_the_third tomo_the_third is offline
Member
 
Join Date: Jun 2009
Posts: 2
Making an object flash on and off constantly

Hi I'm looking to make an object flash on and off and I want to be able to the control the rate at which this happens. I can make it flick on and off randomly:

#make poles go on and off randomly
def mytimer(num):
# pick a 0 or a 1
on = random.choice([0, 1])
# Set the light's visibility to ON (1) or OFF (0)
poles.visible(on)

viz.callback(viz.TIMER_EVENT,mytimer)

viz.starttimer(0,0.5,viz.FOREVER)
Reply With Quote
  #2  
Old 06-23-2009, 11:58 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The following sample shows how to use the viztask module to toggle the visibility of an object at a specified rate:
Code:
import viz
import viztask
viz.go()

model = viz.add('logo.ive',pos=(0,1,5))

def FlashTask(object,period):
	while True:
		yield viztask.waitTime(period)
		object.visible(viz.TOGGLE)
viztask.schedule( FlashTask(model,0.5) )
Reply With Quote
Reply


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:02 AM.


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