예제 #1
0
 def Apply(self, color_buffer):
     Pattern.Apply(self, color_buffer)
     self.__UpdateColorsAndOffset()
     colors = color_buffer.GetColors()
     f = self.__offset
     for i in xrange(min(len(colors), len(self._colors) - 1)):
         colors[i].Add(self._colors[i].Scaled(f))
         colors[i].Add(self._colors[i + 1].Scaled(1.0 - f))
예제 #2
0
 def Apply(self, color_buffer):
     """Recalculates pulse positions for the current time and add pulses."""
     Pattern.Apply(self, color_buffer)
     colors = color_buffer.GetColors()
     n = len(colors)
     for raw_center in self.__GeneratePositions(n - 1):
         center = raw_center
         if self.__reverse:
             center = (n - 1) - center
         min_index = int(1 + center - self.__radius)
         max_index = int(center + self.__radius)
         for i in xrange(min_index, max_index + 1):
             if i < 0 or i >= n:
                 continue
             dx = abs(center - i)
             f = min(1.0, dx / self.__radius)
             colors[i] = colors[i].Scaled(f)
             colors[i].Add(self.__color.Scaled(1.0 - f))
예제 #3
0
 def Apply(self, color_buffer):
     Pattern.Apply(self, color_buffer)
     for c in color_buffer.GetColors():
         c.set(Color.Lerp(self.__opacity, c, self.__color))