forked from glumpy/glumpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollection-markers.py
30 lines (24 loc) · 911 Bytes
/
collection-markers.py
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
26
27
28
29
30
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import numpy as np
from glumpy import app
from glumpy.graphics.collections import MarkerCollection
window = app.Window(1024,1024, color=(1,1,1,1))
@window.event
def on_draw(dt):
window.clear()
markers.draw()
markers['orientation'] += np.random.uniform(0.0,0.1,len(markers))
del markers[0]
if not len(markers):
app.quit()
n = 256
markers = MarkerCollection(orientation='local')
markers.append(np.random.uniform(-1,1,(n,3)),
bg_color = np.random.uniform(0,1,(n,4)),
size = 64, fg_color=(0,0,0,1))
window.attach(markers["transform"])
window.attach(markers["viewport"])
app.run()