import os
import pygame
import time
import random
import math
def setup(screen, etc):
global xr,yr, xr2,yr2,manparts,burstmultiplier,colourthisburst, pose, xoffset, yoffset, flipyn, colourshiftdirection
xr = etc.xres
yr = etc.yres
yr2 = yr*0.5
xr2 = xr*0.5
pose = 1
flipyn = random.choice([-1,1])
xoffset = 0
yoffset = 0
colourthisburst = [255,0,255]
colourshiftdirection = 'pink to red'
manparts = [
[[0,-0.50,0.05],
[0,-0.31,0.03],
[0,-0.23,0.03],
[0,-0.15,0.03],
[0.15,-0.3,0.02],
[0.175,-0.275,0.02],
[0.2,-0.25,0.02],
[0.25,-0.2,0.02],
[-0.15,-0.3,0.02],
[-0.175,-0.275,0.02],
[-0.2,-0.25,0.02],
[-0.25,-0.2,0.02],
[0.05,0.05,0.02],
[0.06,0.13,0.02],
[0.07,0.21,0.02],
[0.08,0.29,0.02],
[-0.05,0.05,0.02],
[-0.06,0.13,0.02],
[-0.07,0.21,0.02],
[-0.08,0.29,0.02]
],
[[-0.09,-0.40,0.05],
[0.025,-0.26,0.03],
[0.075,-0.20,0.03],
[0.095,-0.16,0.03],
[0.085,-0.445,0.02],
[0.095,-0.49,0.02],
[0.105,-0.535,0.02],
[0.105,-0.62,0.02],
[-0.05,-0.13,0.02],
[-0.06,-0.08,0.02],
[-0.07,-0.03,0.02],
[-0.11,0.03,0.02],
[0.25,-0.1,0.02],
[0.325,-0.15,0.02],
[0.375,-0.05,0.02],
[0.4,0.025,0.02],
[0.15,0.02,0.02],
[0.19,0.1,0.02],
[0.14,0.22,0.02],
[0.1,0.29,0.02]
],
[[0.3,0.29,0.05],
[0.16,0.32,0.03],
[0.1,0.28,0.03],
[0.06,0.20,0.03],
[0.12,0.45,0.02],
[0.09,0.48,0.02],
[0.06,0.51,0.02],
[0,0.57,0.02],
[0.25,0.12,0.02],
[0.27,0.1,0.02],
[0.29,0.08,0.02],
[0.35,0.12,0.02],
[0,0.005,0.02],
[0.0,-0.09,0.02],
[0,-0.180,0.02],
[0,-0.27,0.02],
[-0.05,0.15,0.02],
[-0.1,0.10,0.02],
[-0.13,0.23,0.02],
[-0.15,0.31,0.02]
],
[[0,-0.50,0.05],
[0,-0.31,0.03],
[0,-0.23,0.03],
[0,-0.15,0.03],
[0.04,-0.64,0.02],
[-0.0,-0.64,0.02],
[-0.04,-0.64,0.02],
[-0.1,-0.57,0.02],
[-0.13,-0.31,0.02],
[-0.17,-0.31,0.02],
[-0.21,-0.31,0.02],
[-0.27,-0.37,0.02],
[0.09,-0.07,0.02],
[0.15,-0.03,0.02],
[0.12,0.06,0.02],
[0.06,0.09,0.02],
[-0.02,0.05,0.02],
[-0.02,0.13,0.02],
[-0.02,0.21,0.02],
[-0.02,0.29,0.02]
],
[[0,-0.50,0.05],
[0,-0.31,0.03],
[0,-0.23,0.03],
[0,-0.15,0.03],
[0.13,-0.5,0.02],
[0.13,-0.55,0.02],
[0.13,-0.6,0.02],
[0.15,-0.68,0.02],
[-0.13,-0.23,0.02],
[-0.13,-0.18,0.02],
[-0.13,-0.13,0.02],
[-0.15,-0.05,0.02],
[0.11,-0.08,0.02],
[0.175,-0.08,0.02],
[0.22,-0.0,0.02],
[0.22,0.085,0.02],
[-0.02,0.05,0.02],
[-0.02,0.13,0.02],
[-0.02,0.21,0.02],
[-0.02,0.29,0.02]
],
[[0,-0.50,0.05],
[0,-0.31,0.03],
[0,-0.23,0.03],
[0,-0.15,0.03],
[0.15,-0.3,0.02],
[0.19,-0.3,0.02],
[0.23,-0.3,0.02],
[0.3,-0.3,0.02],
[-0.15,-0.45,0.02],
[-0.15,-0.5,0.02],
[-0.15,-0.55,0.02],
[-0.15,-0.63,0.02],
[0.12,-0.09,0.02],
[0.18,-0.04,0.02],
[0.11,0.02,0.02],
[0.05,0.07,0.02],
[-0.1,-0.05,0.02],
[-0.16,-0.01,0.02],
[-0.22,0.03,0.02],
[-0.28,0.07,0.02]
],
[[0,-0.50,0.05],
[0,-0.31,0.03],
[-0.02,-0.23,0.03],
[-0.06,-0.15,0.03],
[0.12,-0.4,0.02],
[0.135,-0.45,0.02],
[0.145,-0.5,0.02],
[0.18,-0.562,0.02],
[-0.12,-0.4,0.02],
[-0.135,-0.45,0.02],
[-0.145,-0.5,0.02],
[-0.18,-0.562,0.02],
[0.03,0.02,0.02],
[0.07,0.09,0.02],
[0.07,0.18,0.02],
[0.07,0.26,0.02],
[-0.14,0.02,0.02],
[-0.14,0.10,0.02],
[-0.14,0.18,0.02],
[-0.14,0.26,0.02]
]
]
burstmultiplier = 1
def draw(screen, etc):
global burstmultiplier, colourthisburst, pose, xoffset, yoffset, flipyn, colourshiftdirection
if etc.audio_trig == True:
burstmultiplier = 1
collowmin = 0
collowmax = 50
colhighmin = 195
colhighmax = 255
flipyn = random.choice([-1,1])
if etc.knob2 > 0:
colourincrement = 85 * etc.knob2
else:
colourincrement = 85 * 0.01
if colourshiftdirection == 'pink to red' and (colourthisburst[2] - colourincrement) > 0:
colourthisburst[2] += (0 - colourincrement)
elif colourshiftdirection == 'pink to red' and (colourthisburst[2] - colourincrement) <= 0:
colourthisburst[2] = 0
colourshiftdirection = 'red to yellow'
elif colourshiftdirection == 'red to yellow' and (colourthisburst[1] + colourincrement) < 255:
colourthisburst[1] += colourincrement
elif colourshiftdirection == 'red to yellow' and (colourthisburst[1] + colourincrement) >= 255:
colourthisburst[1] = 255
colourshiftdirection = 'yellow to green'
elif colourshiftdirection == 'yellow to green' and (colourthisburst[0] - colourincrement) > 0:
colourthisburst[0] += (0 - colourincrement)
elif colourshiftdirection == 'yellow to green' and (colourthisburst[0] - colourincrement) <= 0:
colourthisburst[0] = 0
colourshiftdirection = 'green to light blue'
elif colourshiftdirection == 'green to light blue' and (colourthisburst[2] + colourincrement) < 255:
colourthisburst[2] += colourincrement
elif colourshiftdirection == 'green to light blue' and (colourthisburst[2] + colourincrement) >= 255:
colourthisburst[2] = 255
colourshiftdirection = 'light blue to blue'
elif colourshiftdirection == 'light blue to blue' and (colourthisburst[1] - colourincrement) > 0:
colourthisburst[1] += (0 - colourincrement)
elif colourshiftdirection == 'light blue to blue' and (colourthisburst[1] - colourincrement) <= 0:
colourthisburst[1] = 0
colourshiftdirection = 'blue to pink'
elif colourshiftdirection == 'blue to pink' and (colourthisburst[0] + colourincrement) < 255:
colourthisburst[0] += colourincrement
elif colourshiftdirection == 'blue to pink' and (colourthisburst[0] + colourincrement) >= 255:
colourthisburst[0] = 255
colourshiftdirection = 'pink to red'
pose = random.randint(0,(len(manparts))-1)
xoffset = int(etc.knob3 * (random.randint(int(0-(xr2/1.2)),int(xr2/1.2))))
yoffset = int(etc.knob3 * (random.randint(int(0-(yr2/1.2)),int(yr2/1.2))))
#pose = 6
#flipyn = 1
#xoffset = 0
#yoffset = 0
else:
burstmultiplier = burstmultiplier * (1 + (etc.knob1*0.19))
if etc.knob4 < 1:
colourthisburst = etc.color_picker(etc.knob4)
etc.color_picker_bg(etc.knob5)
for i in range (0,len(manparts[pose])):
xloc = xoffset + (int((xr2+flipyn*((xr2*manparts[pose][i][0])*(burstmultiplier)))))
yloc = yoffset + int((yr2+(yr2*manparts[pose][i][1])*(burstmultiplier)))
csize = int(manparts[pose][i][2]*yr)
pygame.draw.circle(screen,colourthisburst,(xloc,yloc),csize,0)
#font = pygame.font.SysFont(None, 24)
#img = font.render(str(xloc), True, [255,255,255])
#screen.blit(img, (20, 20))