WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-09-2005, 11:37 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

What kind of animations are you performing? Could they be substituted with any existing vizact actions? If so, this would be the easiest and most elegant way to accomplish this.

If not, then you could use the following code as a guideline. It creates a different function for each animation. Then it uses a list to cycle through each animation. Let me know if it isn't clear enough.
Code:
import viz
viz.go()


def update1():
	print 'Update 1'
	
def update2():
	print 'Update 2'
	
def update3():
	print 'Update 3'

anim_seq = [update1,update2,update3] #List of animation functions
anim_time = 60 #Time remaining on current animation
anim_index = 0 #List index of current animation

def update_animation():
	global anim_time, anim_index
	anim_seq[anim_index]() #Call current animation function
	anim_time -= viz.elapsed() #Update remaining time
	if anim_time < 0: #Check if animation finished
		anim_time = 60 #Reset animation time
		anim_index = (anim_index + 1) % len(anim_seq) #Increment animation index

def ontimer(num):
	update_animation()

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0,viz.FOREVER)
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 07:38 AM.


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