vrTimer demo¶
speed.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3newScene()
4
5from random import *
6
7print("Executing speed script!")
8
9# vrAEBase Test
10
11n = 3
12
13def end_msg():
14 print("end")
15
16ae_list = []
17for i in range(n):
18 ae = vrAEBase()
19 ae_list.append(ae)
20
21keyZ = vrKey(Key_Z)
22
23keyZ.connect("print \"begin\"")
24for i in range(n):
25 keyZ.connect(ae_list[i], SWITCH_ON)
26keyZ.connect(end_msg)
27
28# vrTimer Test
29
30def printIsActive(timer):
31 print("Timer state: ", timer.isActive())
32
33timer_list = []
34for i in range(n):
35 t = vrTimer(1)
36 t.connect(printIsActive, t)
37 t.setActive(true)
38 timer_list.append(t)
39
40keyT = vrKey(Key_T)
41for i in range(n):
42 keyT.connect(timer_list[i], SWITCH_TOGGLE)
43
44print("End")