-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharp.py
77 lines (60 loc) · 1.83 KB
/
harp.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- coding: utf-8 -*-
from globalVars import *
import frame
import time
import vectors
import random
import gstt
SPEED = 4
SIZE = 20
bordersize = STRING_SIZE
HARP_OFFSET = vectors.Vector2D(0,0)
class Harp(object):
def __init__(self):
self.x, self.y = screen_size[0]/2, (screen_size[1]/2) + 100
self.space = space
self.strings = strings
self.coloron = COLOR_ON
self.coloroff = COLOR_OFF
self.scolors = [COLOR_OFF] * self.strings
self.ssize = STRING_SIZE
self.offset = [0] * self.strings
print self.offset
def Open(self,strings,space):
for i in range (60):
#print i
gstt.hrp.Move(strings,i)
time.sleep(0.007)
def Color(self,string,color):
self.scolors[string] = colorshex[color]
def Change(self,string):
print self.scolors
print string
if self.scolors[string] == COLOR_OFF:
self.scolors[string] = COLOR_ON
else:
self.scolors[string] = COLOR_OFF
def Event(self,string,state):
if state == 0:
self.scolors[string] = COLOR_OFF
else:
self.scolors[string] = COLOR_ON
def Move(self,strings,space):
self.strings = strings
def Draw(self,f):
xstart = self.x + random.randint(0,10) - ((self.strings / 2) * gstt.space)
self.ssize = STRING_SIZE - random.randint(0,10)
bordersize = STRING_SIZE + 20
LOGO = []
for i in range(strings):
LOGO.append([
[(xstart + gstt.space*i, self.y + self.offset[i]), ((xstart +
gstt.space*i + bordersize), self.y + self.offset[i])],
self.scolors[i]
])
for pl_color in LOGO:
c = pl_color[1]
xy_list = []
for xy in pl_color[0]:
xy_list.append((HARP_OFFSET + vectors.Vector2D(xy[0],xy[1])).ToTuple())
f.PolyLineOneColor(xy_list, c)