Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def police2(duration=250, brightness=100):
"""
Color flashes red and then blue, like urgent police lights.
:param int duration: The duration to fade to next color, in milliseconds.
:param int brightness: The brightness of the transition.
:returns: A list of transitions.
:rtype: list
"""
transitions = [
RGBTransition(255, 0, 0, brightness=brightness, duration=duration),
RGBTransition(255, 0, 0, brightness=1, duration=duration),
RGBTransition(255, 0, 0, brightness=brightness, duration=duration),
SleepTransition(duration=duration),
RGBTransition(0, 0, 255, brightness=brightness, duration=duration),
RGBTransition(0, 0, 255, brightness=1, duration=duration),
RGBTransition(0, 0, 255, brightness=brightness, duration=duration),
SleepTransition(duration=duration),
]
return transitions
"""
Color flashes red and then blue, like urgent police lights.
:param int duration: The duration to fade to next color, in milliseconds.
:param int brightness: The brightness of the transition.
:returns: A list of transitions.
:rtype: list
"""
transitions = [
RGBTransition(255, 0, 0, brightness=brightness, duration=duration),
RGBTransition(255, 0, 0, brightness=1, duration=duration),
RGBTransition(255, 0, 0, brightness=brightness, duration=duration),
SleepTransition(duration=duration),
RGBTransition(0, 0, 255, brightness=brightness, duration=duration),
RGBTransition(0, 0, 255, brightness=1, duration=duration),
RGBTransition(0, 0, 255, brightness=brightness, duration=duration),
SleepTransition(duration=duration),
]
return transitions
:param int red: The red color component to pulse (0-255).
:param int green: The green color component to pulse (0-255).
:param int blue: The blue color component to pulse (0-255).
:param int duration: The duration to pulse for, in milliseconds.
:param int brightness: The brightness to pulse at (1-100).
:returns: A list of transitions.
:rtype: list
"""
red = _clamp(red, 0, 255)
green = _clamp(green, 0, 255)
blue = _clamp(blue, 0, 255)
transitions = [
RGBTransition(red, green, blue, duration=duration, brightness=brightness),
RGBTransition(red, green, blue, duration=duration, brightness=1),
]
return transitions
def police(duration=300, brightness=100):
"""
Color changes from red to blue, like police lights.
:param int duration: The duration between red and blue, in milliseconds.
:param int brightness: The brightness of the transition.
:returns: A list of transitions.
:rtype: list
"""
transitions = [
RGBTransition(255, 0, 0, duration=duration, brightness=brightness),
RGBTransition(0, 0, 255, duration=duration, brightness=brightness),
]
return transitions
def police(duration=300, brightness=100):
"""
Color changes from red to blue, like police lights.
:param int duration: The duration between red and blue, in milliseconds.
:param int brightness: The brightness of the transition.
:returns: A list of transitions.
:rtype: list
"""
transitions = [
RGBTransition(255, 0, 0, duration=duration, brightness=brightness),
RGBTransition(0, 0, 255, duration=duration, brightness=brightness),
]
return transitions