Import the library and examples
This commit is contained in:
commit
7ee61b8ed0
7 changed files with 167 additions and 0 deletions
12
Examples/huecycle.py
Normal file
12
Examples/huecycle.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from tree import RGBXmasTree
|
||||
from colorzero import Color, Hue
|
||||
|
||||
tree = RGBXmasTree()
|
||||
|
||||
tree.color = Color('red')
|
||||
|
||||
try:
|
||||
while True:
|
||||
tree.color += Hue(deg=1)
|
||||
except KeyboardInterrupt:
|
||||
tree.close()
|
||||
14
Examples/onebyone.py
Normal file
14
Examples/onebyone.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from tree import RGBXmasTree
|
||||
from colorzero import Color
|
||||
|
||||
tree = RGBXmasTree()
|
||||
|
||||
colors = [Color('red'), Color('green'), Color('blue')] # add more if you like
|
||||
|
||||
try:
|
||||
while True:
|
||||
for color in colors:
|
||||
for pixel in tree:
|
||||
pixel.color = color
|
||||
except KeyboardInterrupt:
|
||||
tree.close()
|
||||
17
Examples/randomsparkles.py
Normal file
17
Examples/randomsparkles.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from tree import RGBXmasTree
|
||||
import random
|
||||
|
||||
tree = RGBXmasTree()
|
||||
|
||||
def random_color():
|
||||
r = random.random()
|
||||
g = random.random()
|
||||
b = random.random()
|
||||
return (r, g, b)
|
||||
|
||||
try:
|
||||
while True:
|
||||
pixel = random.choice(tree)
|
||||
pixel.color = random_color()
|
||||
except KeyboardInterrupt:
|
||||
tree.close()
|
||||
15
Examples/rgb.py
Normal file
15
Examples/rgb.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from tree import RGBXmasTree
|
||||
from colorzero import Color
|
||||
from time import sleep
|
||||
|
||||
tree = RGBXmasTree()
|
||||
|
||||
colors = [Color('red'), Color('green'), Color('blue')] # add more if you like
|
||||
|
||||
try:
|
||||
while True:
|
||||
for color in colors:
|
||||
tree.color = color
|
||||
sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
tree.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue