Exemplo n.º 1
0
 def apply(self, colorBuffer):
     Pattern.apply(self, colorBuffer)
     self.__updateColorsAndOffset()
     colors = colorBuffer.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))
Exemplo n.º 2
0
	def apply(self, colorBuffer):
		"""
		Recalculate pulse positions for the current time and add pulses.
		"""
		Pattern.apply(self, colorBuffer)
		colors = colorBuffer.getColors()
		n = len(colors)
		for rawCenter in self.__generatePositions(n-1):
			center = rawCenter
			if self.__reverse:
				center = (n - 1) - center
			minIndex = int(1 + center - self.__radius)
			maxIndex = int(center + self.__radius)
			for i in xrange(minIndex, maxIndex+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))
Exemplo n.º 3
0
	def apply(self, colorBuffer):
		Pattern.apply(self, colorBuffer)
		for c in colorBuffer.getColors():
			c.set(Color.Lerp(self.__opacity, c, self.__color))