Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: markfickett/LED-Controller
base: 498b084adb
...
head fork: markfickett/LED-Controller
compare: 4d9c15bedb
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
10 python/ledcontroller/Color.py
@@ -73,6 +73,16 @@ def getRgbBytes(self):
return [int(min(1, max(0, v)) * self.BYTE_MAX)
for v in self.getRgb()]
+ @staticmethod
+ def Lerp(x, a, b):
+ """
+ @return the linear interpolation between Colors a and b,
+ where x=0 is a and x=1 is b.
+ """
+ lerped = a.scaled(1.0-x)
+ lerped.add(b.scaled(x))
+ return lerped
+
@classmethod
def CreateRandom(cls):
return cls(rgb=(
View
1  python/ledcontroller/patterns/Manifest.py
@@ -2,3 +2,4 @@
from PatternList import PatternList
from InterpolatedMarquee import InterpolatedMarquee
from Pulser import Pulser
+from ObscuringColor import ObscuringColor
View
18 python/ledcontroller/patterns/ObscuringColor.py
@@ -0,0 +1,18 @@
+from ledcontroller.Manifest import Color
+from Manifest import Pattern
+
+class ObscuringColor(Pattern):
+ def __init__(self, color, opacity=0.0):
+ Pattern.__init__(self)
+ self.__color = color
+ self.setOpacity(opacity)
+
+ def setOpacity(self, opacity):
+ self._setChanged()
+ self.__opacity = opacity
+
+ def apply(self, colorBuffer):
+ Pattern.apply(self, colorBuffer)
+ for c in colorBuffer.getColors():
+ c.set(Color.Lerp(self.__opacity, c, self.__color))
+
View
10 python/ledcontroller/patterns/PatternList.py
@@ -16,6 +16,16 @@ def append(self, pattern):
"""
self.__patterns.append(pattern)
+ def remove(self, pattern, strict=True):
+ """
+ Remove the given pattern from the list.
+ @param strict whether to match the default Python behavior, or
+ (if False) to silently do nothing if the pattern is not
+ already in the list
+ """
+ if strict or (pattern in self.__patterns):
+ self.__patterns.remove(pattern)
+
def apply(self, colorBuffer):
for p in self.__patterns:
p.apply(colorBuffer)

No commit comments for this range

Something went wrong with that request. Please try again.