-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
25 lines (21 loc) · 712 Bytes
/
test.py
File metadata and controls
25 lines (21 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import viztask
ball1 = viz.add('white_ball.wrl')
ball2 = viz.add('white_ball.wrl')
#Create a signal.
changeColorSignal = viztask.Signal()
def colorBall():
#This task will wait for the signalVi.
while True:
yield changeColorSignal.wait()
ball2.color( viz.RED )
yield changeColorSignal.wait()
ball2.color( viz.BLUE )
def moveBall():
#This task will repeated send the signal.
while True:
yield viztask.addAction( ball1, vizact.moveTo([0,0,0],speed=1) )
changeColorSignal.send()
yield viztask.addAction( ball1, vizact.moveTo([-1,0,0],speed=1) )
changeColorSignal.send()
viztask.schedule( colorBall() )
viztask.schedule( moveBall() )