PDA

View Full Version : TexQuad FadeOut/FadeIn issue


kovitch
06-06-2012, 11:35 AM
Hi,

I'm experiencing some kind of a problem, when using fadein/fadeout on viz.SCREEN. Despite the code I use there's no fadeOut. The image justa appears after 1 sec.

The code I use is:


def drawTrainingList(self,prod_list):

products_per_column = 8

image_y_position = 0.75225
image_x_position = 0.125

background_x_inc = 0.125

image_y_pos_inc = 0.097
image_x_pos_inc = 0.3335

number_x_pos_inc = 0.07
number_y_pos_inc = 0.05

text_x_pos_inc = 0.01
text_y_pos_inc = 0.05

if len(prod_list) < 9:
image_x_position += image_x_pos_inc
elif len(prod_list) > 8 and len(prod_list) < 17:
image_x_position += image_x_pos_inc/2

product_index = 0

self.background_texture_list = []
self.product_texture_list = []
self.product_text_list = []
self.seq_numbers_list = []

fadeOut = vizact.sequence( vizact.method.visible(1), vizact.fadeTo(1.0,speed=1.0) )

self.background_wallpaper = viz.addTexQuad(viz.SCREEN,align=viz.TEXT_LEFT_BOTT OM,pos=(0,-0.1,0),scale=(12.8,11.725,1))
self.background_wallpaper_texture = viz.add(config.SCREEN_PATH + 'background.png')
self.background_wallpaper.texture(self.background_ wallpaper_texture)

self.title_text = viz.addText('Ingredients', parent = viz.SCREEN,align=viz.TEXT_CENTER_CENTER,pos=(0.5,0 .92,0),scale=(0.85,1,1))

while product_index < len(prod_list):
if product_index % products_per_column == 0 and product_index != 0:
image_x_position += image_x_pos_inc
image_y_position = 0.75225

self.background_texture_list.append(viz.addTexQuad (viz.SCREEN,align=viz.TEXT_LEFT_BOTTOM,pos=(image_ x_position-background_x_inc,image_y_position,0)))
self.background_texture_list[product_index].texture(prod_list[product_index].background)
self.background_texture_list[product_index].setScale(4.275,1.0)
self.background_texture_list[product_index].alpha(0)
self.background_texture_list[product_index].visible(0)

self.product_texture_list.append(viz.addTexQuad(vi z.SCREEN,align=viz.TEXT_RIGHT_BOTTOM,pos=(image_x_ position,image_y_position,0)))
self.product_texture_list[product_index].texture(prod_list[product_index].texture)
self.product_texture_list[product_index].setScale(0.775,1.0)
self.product_texture_list[product_index].alpha(0)
self.product_texture_list[product_index].visible(0)

self.product_text_list.append(viz.addText(prod_lis t[product_index].name,viz.SCREEN,align=viz.TEXT_LEFT_CENTER,pos=(i mage_x_position+text_x_pos_inc,image_y_position+te xt_y_pos_inc,0),scale=[0.35,0.4,0.4]))
self.product_text_list[product_index].alpha(0)
self.product_text_list[product_index].visible(0)

self.seq_numbers_list.append(viz.addText(str(produ ct_index+1)+'.',viz.SCREEN,align=viz.TEXT_RIGHT_CE NTER,pos=(image_x_position-number_x_pos_inc,image_y_position+number_y_pos_inc ,0)))
self.seq_numbers_list[product_index].alpha(0)
self.seq_numbers_list[product_index].visible(0)
self.seq_numbers_list[product_index].setScale(0.3,0.4)

self.background_texture_list[product_index].runAction(fadeOut)
self.product_texture_list[product_index].runAction(fadeOut)
self.product_text_list[product_index].runAction(fadeOut)
self.seq_numbers_list[product_index].runAction(fadeOut)

image_y_position -= image_y_pos_inc
product_index += 1

yield viz.waittime(config.DRAW_LIST_ELEMENT_INTERVAL)


What is the problem with the desired effect? Am I missing something?

I've arealdy tried something like this to 3d models and everything runs smoothly.

Best regars,

Alex.

farshizzo
06-06-2012, 02:51 PM
What is the value of the config.DRAW_LIST_ELEMENT_INTERVAL variable? You are passing this value to viz.waittime, which will block rendering for the specified amount of seconds. If the value of the variable is around 1 second, then you are stalling the frame for a second and it when it continues, the fade action will be complete.

I noticed you are yielding the value of viz.waittime. Were you intending to use viztask.waitTime instead?

kovitch
06-07-2012, 12:25 PM
You're totaly right i wanted to use viztask instead, my bad. Thanks! :)