本文整理汇总了Python中color.Color.heat_colors方法的典型用法代码示例。如果您正苦于以下问题:Python Color.heat_colors方法的具体用法?Python Color.heat_colors怎么用?Python Color.heat_colors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类color.Color
的用法示例。
在下文中一共展示了Color.heat_colors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from color import Color [as 别名]
# 或者: from color.Color import heat_colors [as 别名]
#.........这里部分代码省略.........
def iterate_states_threaded(self, generator, delay=0.03):
self.network.generator = generator
if not self.network.run_thread:
self.network.start_sender_thread()
def iterate_generator(self, generator):
self.network.generator = generator
def numbering(self):
"""Cycle through strips to find out numbering."""
for i in range(self.strips):
state = self.state_factory.state_off()
print(i)
self.network.send(self.state_factory.set_strips(state, [i], [1, 1, 1]))
time.sleep(1)
def fft_init(self, delay=0.03):
"""
Initialize a thread that starts FFT-Analysation.
If a thread has already been started and FFT is running, no
new thread is started.
"""
if not self.fft.run_thread:
self.fft.start_analyse_thread()
time.sleep(delay)
def fft_destroy(self):
"""Stop FFT-thread."""
self.fft.stop_analyse_thread()
def fft_eq(self, colors=None, scale=1, delay=0.03, threshold=0, groups=GROUPS):
if colors is None:
colors = self.color.heat_colors()
self.fft_init()
state = self.state_factory.state_off()
while True:
intensity = [((scale * i) if i > threshold else 0) for i in self.fft.intensity()]
if DEBUG:
print(intensity)
for i in range(len(groups)):
if i < len(intensity):
self.state_factory.set_strips(state, GROUPS[i], colors[np.clip(intensity[i], 0, 99)])
yield state
def fft_pulse_map(self, colors=None, scale=1, delay=0.03, threshold=0, channel=0):
if colors is None:
colors = self.color.heat_colors()
self.fft_init()
state = self.state_factory.state_off()
while True:
intensity = [((scale * i) if i > threshold else 0) for i in self.fft.intensity()]
if DEBUG:
print(intensity)
state = self.state_factory.full_color(colors[np.clip(intensity[channel], 0, len(colors) - 1)])
yield state
def fft_pulse_color(self, color=Color.white, scale=1, delay=0.03, channel=0, threshold=0):
self.fft_init()
state = self.state_factory.state_off()
while True:
intensity = [((scale * i) if i > threshold else 0) for i in self.fft.intensity()]
if DEBUG:
print(intensity)
state = self.state_factory.full_color(Color.alpha(color, intensity[channel] / 100))
yield state