def initPlan(self, plan): self.isPlanInit = True for led in range(0, Constants.glasses * Constants.ledsPerGlass): if led % 8 == 0: clockObject = ClockObject() clockObject.pos = led + 1 clockObject.color = self.rightDirectionColor clockObject.direction = 0 plan[clockObject.pos] = clockObject clockObject = ClockObject() clockObject.pos = led clockObject.color = self.leftDirectionColor clockObject.direction = 1 plan[clockObject.pos] = clockObject
def initPlan(self, plan): self.isPlanInit = True for index in range(0, Constants.leds): clockObject = ClockObject() clockObject.color = [0, 0, 0] plan[index] = clockObject
def show(self, plan): clockObject = ClockObject() clockObject.color = [50, 50, 50] for index in range(0, Constants.leds): plan[index] = clockObject self.drawing.clockPlan(plan)
def show(self, plan): clockObject = ClockObject() if (self.counter == 0): clockObject.color = self.getRainbowColorForPosition(0) else: clockObject.color = self.getRainbowColorForPosition( ((self.counter * (self.rgbMaxValue * 3) / Constants.glasses) % (self.rgbMaxValue * 3))) for index in range(0, Constants.ledsPerGlass): plan[(self.counter * Constants.ledsPerGlass) + index] = clockObject self.drawing.clockPlan(plan) self.counter += 1 if (self.counter >= Constants.glasses): self.resetState() self.nextModeCallback()
def show(self, plan): clockObject = ClockObject() clockObject.color = self.getColorForState() for index in range(0, Constants.ledsPerGlass): plan[(self.counter * Constants.ledsPerGlass) + index] = clockObject self.drawing.clockPlan(plan) self.counter += 1 self.checkState()
def show(self, plan): self.counter += Constants.ledsPerGlass clockObject = ClockObject() clockObject.color = [0,0,0] maxIndex = 0 if self.counter > (Constants.glasses * Constants.ledsPerGlass): maxIndex = Constants.glasses * Constants.ledsPerGlass else: maxIndex = self.counter for index in range(0, maxIndex): planObject = plan[index] if planObject == None: plan[index] = clockObject else: planObject.color = self.getColorForRounds(planObject.color) self.drawing.clockPlan(plan) self.checkState()
def show(self, plan): self.counter += Constants.ledsPerGlass for led in range(0, Constants.leds): if plan[led] != None: plan[led].color = [0, 0, 0] direction = 1 step = 51 for index in range(0, Constants.glasses): for led in range(0, Constants.ledsPerGlass): clockObject = ClockObject() clockObject.color = copy.copy(self.color) plan[(index * Constants.ledsPerGlass) + led] = clockObject self.color[0] = int((math.sin(index) * 127 + 128) / 255) self.color[0] += (step * direction) self.drawing.clockPlan(plan) self.checkState()