Exemple #1
0
def startVisualizer(t):
    spotify.seek_track(0, device_id=None)
    songProps = dataRetrieve.dataRetrieve()
    t.reset()
    # dataRetrieve.restartCurrent()
    # win.bgpic(songProps["albumCover"])
    pal = colourChoice.choose_palette(songProps["danceability"],
                                      songProps["acousticness"])
    pal = colourChoice.energy_mod(pal, songProps["energy"])
    dummy = drawSpiral(t, songProps["duration"], songProps["sectionLoudness"],
                       songProps["tempo"], pal)
Exemple #2
0
    def __init__(self, screen, startx, starty):

        songProps = dataRetrieve.dataRetrieve()
        # pos = [win.window_width(),win.window_height()]
        pal = colourChoice.choose_palette(songProps["danceability"],
                                          songProps["acousticness"])
        pal = colourChoice.energy_mod(pal, songProps["energy"])
        dur = 100
        self.t = turtle.RawTurtle(canvas)
        self.t = Turtle(visible=False)
        self.t.shapesize(3, 3, 6)
        self.t.speed(9)
        # tstart(self.t)
        spr = Spiralizer(dur)
        c = 0
        c = 0
        index = 0
        index2 = 0
        # win.bgcolor("#"+pal[len(pal)-1])
        for ss in range(0, spr.getIts()):
            self.t.color("#" + pal[index2])
            bw = c - ss
            if (bw > 0 and spr.notInSeen(bw)):
                self.t.setheading(90)  # 90 degrees is pointing straight up
                # 180 degrees means "draw a semicircle"
                # t.circle(5 * abs(loudList[index])/len(loudList), 180)
                c = bw
                spr.addCurr(c)
                # index = (index + 1)%len(loudList)
            else:
                self.t.setheading(270)  # 270 degrees is straight down
                # t.circle(5 * abs(loudList[index])/len(loudList), 180)
                c += ss
                spr.addCurr(c)
                # index = (index + 1)%len(loudList)
            index2 = (index2 + 1) % (len(pal) - 1)
Exemple #3
0
def setColors(energy, danceability, acousticness):
    # print("setting colors")
    # print(energy)
    # print(danceability)
    # print(acousticness)
    # darkColours = ["612b16", "270e80", "66404c", "2e4d65", "2b7643", "612b91", "612bcd", "1f404c", "227643", "612bff", "470e6d", "a9404c", "0a7643", "271680", "37404c", "68404c", "612b58", "062936", "062936", "22064f", "22124f"]
    darkColourHex = ['0', '1', '2', '3', '4', '6']
    pal = colourChoice.choose_palette(danceability, acousticness)
    pal = colourChoice.energy_mod(pal, energy)
    # print(pal)
    bgChosen = pal[random.randint(0, 3)]
    bgColour = bgChosen[0:4] + "00"
    # print(bgChosen + "->" + bgColour)
    # print(bgColour)
    root.config(background="#" + bgColour)
    topFrame.config(background="#" + bgColour)
    titleFrame.config(background="#" + bgColour)
    canvas.config(background="#" + bgColour)
    if (bgColour[0] in darkColourHex):
        # print("DARK!")
        songLabel.config(background="#" + bgColour, foreground="#ffffff")
    else:
        songLabel.config(background="#" + bgColour, foreground="#000000")
    welcomeLabel.config(background="#" + bgColour, foreground="#000000")
Exemple #4
0
def mbrotDisplay(dur):
    mandelbrot = Mandelbrot(dur)
    t = Turtle(visible=False)
    t.speed(0)
    tstart(t)
    tfinish = time.time() + dur
    win.tracer(0)
    while (time.time() < tfinish):
        currtime = int(time.time())
        for y in range(-151, 151):
            mandelbrot.computeCardinality(turtleConvert(currtime, y))
            t.color(mandelbrot.getColor())
            t.goto(y, y)
        t.up()
        t.goto(currtime + 1, 151)
        t.down()
        win.update()
    win.tracer(1)


win = Screen()
win.setup(width=.75, height=.75)
songProps = dataRetrieve.dataRetrieve()
# win.bgpic(songProps["albumCover"])
pos = [win.window_width(), win.window_height()]
pal = colourChoice.choose_palette(songProps["danceability"],
                                  songProps["acousticness"])
pal = colourChoice.energy_mod(pal, songProps["energy"])
dummy = drawSpiral(songProps["duration"], songProps["sectionLoudness"])