-
Notifications
You must be signed in to change notification settings - Fork 0
/
2blit.py
120 lines (94 loc) · 2.39 KB
/
2blit.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Simple box decreasing toward center usin blit
import pew
# Intialise Device
pew.init()
# Create Blank Screen Image
screen = pew.Pix()
# Set Loop Delay Value in Seconds
delay = 1/2
# Setup sring to hold blank screen
sb = pew.Pix.from_iter((
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
))
# Setup string all outer pixels
s0 = pew.Pix.from_iter((
(1, 1, 1, 1, 1, 1, 1, 1),
(1, 0, 0, 0, 0, 0, 0, 1),
(1, 0, 0, 0, 0, 0, 0, 1),
(1, 0, 0, 0, 0, 0, 0, 1),
(1, 0, 0, 0, 0, 0, 0, 1),
(1, 0, 0, 0, 0, 0, 0, 1),
(1, 0, 0, 0, 0, 0, 0, 1),
(1, 1, 1, 1, 1, 1, 1, 1),
))
# Setup string move next layr in
s1 = pew.Pix.from_iter((
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 1, 1, 1, 1, 1, 1, 0),
(0, 1, 0, 0, 0, 0, 1, 0),
(0, 1, 0, 0, 0, 0, 1, 0),
(0, 1, 0, 0, 0, 0, 1, 0),
(0, 1, 0, 0, 0, 0, 1, 0),
(0, 1, 1, 1, 1, 1, 1, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
))
# Setup string 3rd layer
s2 = pew.Pix.from_iter((
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 2, 2, 2, 2, 0, 0),
(0, 0, 2, 0, 0, 2, 0, 0),
(0, 0, 2, 0, 0, 2, 0, 0),
(0, 0, 2, 2, 2, 2, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
))
# Setup string middle 4 pixels - Max Brightness
s3 = pew.Pix.from_iter((
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 3, 3, 0, 0, 0),
(0, 0, 0, 3, 3, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0),
))
# Loop Forever
while True:
# Copy Image Stored in ( s0 ) to screen
screen.blit(s0)
# Update Screen
pew.show(screen)
# Pause
pew.tick(delay)
# Copy Image Stored in ( s1 ) to screen
screen.blit(s1)
# Update Screen
pew.show(screen)
pew.tick(delay)
# Copt image stored in s2
screen.blit(s2)
pew.show(screen)
# Pause
pew.tick(delay)
# Copy Image Stored in ( s3 ) to screen
screen.blit(s3)
pew.show(screen)
# iterate 9 times beteen blank screen & s3
for index in range(7):
screen.blit(sb)
pew.show(screen)
pew.tick(delay / 8)
screen.blit(s3)
pew.show(screen)
pew.tick(delay / 8)
# Pause
pew.tick(delay)