PDA

View Full Version : color


jaclyn.bill
11-11-2008, 08:17 AM
Hi,

Quick question, I have programmers block on this.

I have a script set up in which a ball.ive pops up on the screen, moves, then repeats this in a timer loop many times.

I want the ball to occasionally be colored red. i have a previously defined list of when I want this to happen. Just picking out bits that are relevant here.


color_select = [0,50,0,0,0]

...

CS = color_select[i]

...

if CS == 50:
ball2.color(1,0,0)
if CS == 0:
ball2.color(viz.clearcolor)


The ball goes red but then stays like that, but I want it to look normal on "0" trails. Is there a simple command for removing colour, the viz.clearcolor is obviously wrong.

Thank you in advance.

JB

farshizzo
11-11-2008, 03:22 PM
I don't know what you mean by "removing the color". Every object has a color, so do you mean black (0,0,0) or white (1,1,1), or something else?

jaclyn.bill
11-12-2008, 01:23 AM
Hi,

sorry, the ball is actually the soccerball.ive which comes with vizard. I only want to remove the red I applied to it and return it to it's original black and white with shading state. Using, 0,0,0 or 1,1,1 however, makes it look darker or lighter than the original.

thanks. JB

farshizzo
11-12-2008, 10:16 AM
The following code shows how to apply a color and then restore the original:#Set red color
model.color(viz.RED,op=viz.OP_OVERRIDE)

#Clear color attribute to restore original color
model.clearAttribute(viz.ATTR_COLOR,op=viz.OP_OVER RIDE)