Guest User

DD Lyrics+Beatblocks

a guest
Jun 8th, 2022
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.23 KB | None | 0 0
  1. #colorblock keyframe("shape, scale, fill_color, xOffset, yOffset") 1216x640
  2. ##Kickdrums
  3. colorblocks =   "3744:(circle, 1, #000000, -500, -300), 3762:(circle, 1, #000000, 0, -300),3780:(circle, 1, #000000, 500, -300),"
  4. colorblocks +=  "3789:(circle, 1, #222222, -500, -300), 3798:(circle, 1, #222222, 0, -300),3810:(circle, 1, #222222, 500, -300),"
  5. colorblocks +=  "3814:(circle, 1, #000000, -500, -300), 3833:(circle, 1, #000000, 0, -300),3851:(circle, 1, #000000, 500, -300),"
  6. colorblocks +=  "3869:(circle, 1, #222222, -500, -300), 3887:(circle, 1, #222222, 0, -300),3905:(circle, 1, #222222, 500, -300),"
  7. colorblocks +=  "3923:(circle, 1, #000000, -500, -300), 3940:(circle, 1, #000000, 0, -300),3958:(circle, 1, #000000, 500, -300),"
  8. colorblocks +=  "3976:(circle, 1, #222222, -500, -300), 3993:(circle, 1, #222222, 0, -300),4011:(circle, 1, #222222, 500, -300),"
  9. colorblocks +=  "4029:(circle, 1, #000000, -500, -300), 4034:(circle, 1, #000000, 0, -300),4036:(circle, 1, #000000, 500, -300),"
  10. colorblocks +=  "4038:(circle, 1, #222222, -500, -300), 4047:(circle, 1, #222222, 0, -300),4065:(circle, 1, #222222, 500, -300),"
  11. colorblocks +=  "4074:(circle, 1, #000000, -500, -300), 4083:(circle, 1, #000000, 0, -300),4092:(circle, 1, #000000, 500, -300),"
  12. colorblocks +=  "4100:(circle, 1, #222222, -500, -300), 4119:(circle, 1, #222222, 0, -300),4136:(circle, 1, #222222, 500, -300),"
  13. colorblocks +=  "4154:(circle, 1, #000000, -500, -300), 4172:(circle, 1, #000000, 0, -300),4190:(circle, 1, #000000, 500, -300),"
  14. colorblocks +=  "4207:(circle, 1, #222222, -500, -300), 4225:(circle, 1, #222222, 0, -300),4243:(circle, 1, #222222, 500, -300),"
  15. colorblocks +=  "4259:(circle, 1, #000000, -500, -300), 4263:(circle, 1, #000000, 0, -300),4278:(circle, 1, #000000, 500, -300),"
  16. colorblocks +=  "4296:(circle, 1, #222222, -500, -300), 4314:(circle, 1, #222222, 0, -300),"
  17.  
  18. #Snare hits
  19. colorblocks +=  "3753:(square, 1, #FFFFFF, -500, 300), 3770:(square, 1, #FFFFFF, 500, 300),"
  20. colorblocks +=  "3806:(square, 1, #DDDDDD, -500, 300), 3824:(square, 1, #DDDDDD, 500, 300),"
  21. colorblocks +=  "3842:(square, 1, #FFFFFF, -500, 300), 3860:(square, 1, #FFFFFF, 500, 300),"
  22. colorblocks +=  "3877:(square, 1, #DDDDDD, -500, 300), 3913:(square, 1, #DDDDDD, 500, 300),"
  23. colorblocks +=  "3931:(square, 1, #FFFFFF, -500, 300), 3949:(square, 1, #FFFFFF, 500, 300),"
  24. colorblocks +=  "3967:(square, 1, #DDDDDD, -500, 300), 3985:(square, 1, #DDDDDD, 500, 300),"
  25. colorblocks +=  "4003:(square, 1, #FFFFFF, -500, 300), 4020:(square, 1, #FFFFFF, 500, 300),"
  26. colorblocks +=  "4038:(square, 1, #DDDDDD, -500, 300), 4055:(square, 1, #DDDDDD, 500, 300),"
  27. colorblocks +=  "4109:(square, 1, #FFFFFF, -500, 300), 4127:(square, 1, #FFFFFF, 500, 300),"
  28. colorblocks +=  "4145:(square, 1, #DDDDDD, -500, 300), 4163:(square, 1, #DDDDDD, 500, 300),"
  29. colorblocks +=  "4180:(square, 1, #FFFFFF, -500, 300), 4198:(square, 1, #FFFFFF, 500, 300),"
  30. colorblocks +=  "4216:(square, 1, #DDDDDD, -500, 300), 4234:(square, 1, #DDDDDD, 500, 300),"
  31. colorblocks +=  "4252:(square, 1, #FFFFFF, -500, 300), 4269:(square, 1, #FFFFFF, 500, 300),"
  32. colorblocks +=  "4287:(square, 1, #DDDDDD, -500, 300), 4305:(square, 1, #DDDDDD, 500, 300),"
  33. colorblocks +=  "4313:(square, 1, #FFFFFF, -500, 300),"
  34.  
  35. #keyframe("text,xoffset,yoffset,pointsize")
  36. lyric_text_keyframes = parse_key_frames(lyric_texts)
  37.  
  38. #keyframe("shape, scale, fill_color, xOffset, yOffset")
  39. beat_colorblocks_keyframes = parse_key_frames(colorblocks)
  40.  
  41. ### Added by Mark
  42. from PIL import Image, ImageDraw, ImageFont
  43. import PIL
  44.  
  45. def checkBonusKeyframes(frameNum):
  46.     if frameNum in lyric_text_keyframes:
  47.         addLyricToImage(lyric_text_keyframes[frameNum])
  48.     elif frameNum in colorblock_keyframes:
  49.         addColorBeatToImage(colorblock_keyframes[frameNum])
  50.     return
  51.  
  52. def addLyricToImage(keyframe):
  53.     text, xoffset, yoffset, pointsize = keyframe.split(',')
  54.     text_color = (255, 255, 255)
  55.     stroke_color = (0, 0, 0)
  56.     img = PIL.Image.open("./prevFrame.png")
  57.     width, height = img.size
  58.     font = ImageFont.truetype('//wsl.localhost/Ubuntu/usr/share/fonts/truetype/ElegantTypewriterBold-BWnYG.ttf', int(pointsize))
  59.     draw = ImageDraw.Draw(img)
  60.     draw.text((width/2 + int(xoffset), height/2 - int(yoffset)), text, font=font, fill=text_color , stroke_width=4, stroke_fill=stroke_color, anchor="mm")
  61.  
  62.     img.save('prevFrame.png')
  63.     return
  64.  
  65. def addColorBeatToImage(keyframe):
  66.     shapeType, scale, fill_color, xOffset, yOffset = keyframe.split(',')
  67.     img = PIL.Image.open("./prevFrame.png")
  68.     draw = ImageDraw.Draw(img)
  69.     scale = int(scale)
  70.     xOffset = int(xOffset)
  71.     yOffset = int(yOffset)
  72.    
  73.     stroke_color_circle = (255,255,255)
  74.     stroke_color_square = (0,0,0)
  75.     width, height = img.size
  76.     pos1 = (width / 2 + 50 * scale + xOffset, height / 2 + 50 * scale - yOffset)
  77.     pos2 = (width / 2 - 50 * scale + xOffset, height / 2 - 50 * scale - yOffset)
  78.     shape = [pos2, pos1]
  79.     print(pos1, pos2)
  80.     if shapeType == "circle":
  81.         draw.ellipse(shape, fill=fill_color.strip(), outline=stroke_color_circle, width=7)
  82.         print('drew circle')
  83.     else: #shapeType == "square":
  84.         draw.rectangle(shape, fill=fill_color.strip(), outline=stroke_color_square, width=7)
  85.    
  86.     img.save('prevFrame.png')
  87.     return
  88. ###
  89.  
  90.  
  91.  
Advertisement
Add Comment
Please, Sign In to add comment