from bibliopixel import *
import bibliopixel.colors as colors
from bibliopixel.drivers.visualizer import DriverVisualizer
import bibliopixel.log as log
log.setLogLevel(log.DEBUG)
import time

from BiblioPixelAnimations.matrix.TallClock import TallClock
from BiblioPixelAnimations.matrix.ImageShow import ImageShow

driver = DriverVisualizer(width=25, height=50, pixelSize=10)
led = LEDMatrix(driver, serpentine=False, threadedUpdate=True)

anim = ImageShow(led, "G:/Testing/bttf.png", offset=(0,0))
anim.run(fps=10)
# anim = TallClock(led)
# anim.run(fps=30)

# anim = ImageDissolve(led, ["G:/Testing/anims/1.bmp", "G:/Testing/anims/2.bmp", "G:/Testing/anims/3.bmp", "G:/Testing/anims/4.bmp"], pixelRate=20)
# anim.run(fps=30, untilComplete=True)
    try:

        # anim = EQ(led)
        # anim.run(fps=30)

        #eq = MSGEQ7(lower_threshold = 70)
        # anim = Spectrum(led, steps_per_vis=50, bins=64, max_freq=2000, gain=3)
        # anim.run(fps=15)
        #
        # anim = ScreenGrab(led, bbox =(1920,0,1920+1024,768), mirror = False, offset = 0.0, crop = True)
        # anim.run(fps=12)
        # anim = ScrollText(led, "WyoManiacal", xPos=NUM_LEDS_PER_STRIP/2, yPos=0, color=colors.White)
        while True:
            # anim = ImageAnimFolder(led, "./anims", cycles=3)
            # anim.run()
            anim = ImageShow(led, imagePath="G:/ManiacalLabs/WyoDisplayVideos/logo_wyo.png", offset = (0,0))
            #anim = ImageAnim(led, imagePath="./anims/zelda.gif")
            anim.run(fps=10)#untilComplete=True, max_cycles=20)
            # anim = LangtonsAnt(led, antColor=colors.Green, pathColor=colors.Red)
            # anim.run(fps=30, seconds=5.4)#, max_steps=75)
            anim = CirclePop(led)
            anim.run(fps=30, seconds=5)
            anim = Mainframe(led, scroll = False)
            anim.run(fps=5, max_steps=40)
            anim = PerlinSimplex(led, freq=32, octaves=1, type=True)
            anim.run(fps=30, seconds=5)
            anim = Bloom(led, dir=True)
            anim.run(fps=30, amt=6, seconds=5)
            anim = GameOfLifeRGB(led, toroidal=True)
            anim.run(amt=1, fps=15, seconds=5)
            anim = MatrixRainBow(led, tail=4, growthRate=7)