示例#1
0
def fourstepmover(duration, color, background=BLACK, fadeDivisor=2.0):
    c = Chase()
    p0 = PartyBar()
    p1 = PartyBar()
    p1.l1(color)
    p1.l2(background)
    p1.l3(background)
    p1.l4(background)

    p2 = PartyBar()
    p2.l1(background)
    p2.l2(color)
    p2.l3(background)
    p2.l4(background)
    p3 = PartyBar()
    p3.l1(background)
    p3.l2(background)
    p3.l3(color)
    p3.l4(background)
    p4 = PartyBar()
    p4.l1(background)
    p4.l2(background)
    p4.l3(background)
    p4.l4(color)

    sceneDur = duration / 4.0

    c.add(FadeCommand(None, p1, 0, sceneDur / fadeDivisor))
    c.add(FadeCommand(p1, p2, sceneDur, sceneDur / fadeDivisor))
    c.add(FadeCommand(p2, p3, sceneDur, sceneDur / fadeDivisor))
    c.add(FadeCommand(p3, p4, sceneDur, sceneDur / fadeDivisor))
    c.add(SleepCommand(sceneDur))
    return c
示例#2
0
def lf(c1, c2):
    p1 = PartyBar().all(c1)
    p2 = PartyBar().all(c2)
    c = Chase()
    c.add(FadeCommand(p1, p2, 15, 15.8))
    c.add(FadeCommand(p2, p1, 16, 15.8))
    c.loop = True
    return c
示例#3
0
def twobardimmer(pb):
    c = Chase()
    pb2 = PartyBar.clone(pb)
    pb2.dim(0)
    # If we run the dim for the whole measure we lose time to
    # hit the next beat
    c.add(FadeCommand(pb, pb2, 0, 3.75))
    c.add(FadeCommand(pb2, pb, 4, 3.75))
    return c
示例#4
0
def fourbardoubler(chase):
    c = Chase()
    c.extend(chase)
    c.extend(chase)
    chase = doubletime(chase)
    c.extend(chase)
    c.extend(chase)
    chase = doubletime(chase)
    c.extend(chase)
    c.extend(chase)
    c.extend(chase)
    c.extend(chase)
    return c
示例#5
0
def strobe(scene, beatdivision, duration):
    c = Chase()

    off = PartyBar.clone(scene)
    off.dim(0)

    numScenes = (1.0 / beatdivision) * duration
    numScenes = numScenes / 2
    sceneDuration = beatdivision
    scenes = 0
    while scenes < numScenes:
        print("Adding commands" + str(scenes))
        c.add(SceneCommand(off, 0))
        c.add(SceneCommand(scene, beatdivision))
        c.add(SleepCommand(beatdivision))
        scenes = scenes + 1

    return c
示例#6
0
def onebardimmer(pb):
    c = Chase()
    pb2 = PartyBar.clone(pb)
    pb2.dim(0)
    c.add(FadeCommand(pb, pb2, 0, 4))
    return c
示例#7
0
    def on_mouse_click(self, e):
        animal_pos = self.convert_to_animal_pos(e.pos())
        if e.button() == Qt.LeftButton:
            self.chase.add_sheep(animal_pos.x(), animal_pos.y())
            self.updateSheepLabel()
        elif e.button() == Qt.RightButton:
            self.chase.wolf.setPos(animal_pos.x(), animal_pos.y())
        self.render()

    def on_reset_clicked(self):
        self.chase.reset()
        self.render()

    def render(self):
        painter = QtGui.QPainter(self.canvas.pixmap())
        self.canvas.pixmap().fill(Qt.green)
        self.draw_wolf(painter)
        self.draw_sheep(painter)
        self.updateSheepLabel()
        self.update()


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    ui = ChaseGui(Chase(350, 20, 30))
    ui.setupUi()
    ui.show()
    sys.exit(app.exec_())
示例#8
0
 def runCommand(self, command):
     self.lastQueue.put(Chase().add(command))