vertex animation¶
vertices.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3# animates some vertices of a simple cube.
4newScene()
5
6sign = 1.0
7
8def animate(node):
9 global sign
10 positions = node.getPositions()
11 new_positions = []
12 for p in positions:
13 p = p + 1 * sign
14 new_positions.append(p)
15 node.setPositions(new_positions)
16 sign = sign * -1.0
17
18node = createBox(0.5, 0.5, 0.5, 1, 1, 1, 1.0, 0.0, 0.0, 0)
19# for vertices animation we disable the display list cache to get more speed!
20node.setDlistCache(false)
21
22timer = vrTimer(0.0)
23timer.connect(animate, node)
24timer.setActive(true)
25
26updateScene()
27setNear(0.1)