-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathGuruGuruSanta013.py
More file actions
50 lines (40 loc) · 1.91 KB
/
GuruGuruSanta013.py
File metadata and controls
50 lines (40 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from anime2021.anime import *
christmas_santa_sori = 'https://1.bp.blogspot.com/-8FaGc_NoAiU/UYzXHqVasJI/AAAAAAAAR4k/540GCCzmI38/s500/christmas_santa_sori.png'
small_star7_yellow = 'https://2.bp.blogspot.com/-iLvMf6s3b6M/V0QnoQqvVzI/AAAAAAAA69w/AdU5l6HIy3MX5CTXrfbMNNLbuksyyoC3QCLcB/s800/small_star7_yellow.png'
class AImage(AShape):
color: any
def __init__(self, width=100, height=None, cx=None, cy=None, image = small_star7_yellow):
AShape.__init__(self, width, height, cx, cy)
if image.startswith('http'):
self.pic = Image.open(io.BytesIO(requests.get(image).content))
else:
self.pic = Image.open(image)
def render(self, canvas: ACanvas, frame: int):
ox, oy, w, h = self.bounds()
pic = self.pic.resize((int(w), int(h)))
canvas.image.paste(pic, (int(ox), int(oy)), pic)
class AImage2(AShape):
color: any
def __init__(self, width=100, height=None, cx=None, cy=None, image = christmas_santa_sori):
AShape.__init__(self, width, height, cx, cy)
if image.startswith('http'):
self.pic = Image.open(io.BytesIO(requests.get(image).content))
else:
self.pic = Image.open(image)
def render(self, canvas: ACanvas, frame: int):
ox, oy, w, h = self.bounds()
pic = self.pic.resize((int(w), int(h)))
canvas.image.paste(pic, (int(ox), int(oy)), pic)
class GuruGuruSanta(AShape):
def __init__(self, width=100, height=None, cx=None, cy=None, N=3):
AShape.__init__(self, width, height, cx, cy)
self.N = N
self.image = AImage(width, height, cx, cy)
self.image2 = AImage2(width, height, cx, cy)
def render(self, canvas, tick):
self.image.cx = self.cx
self.image.cy = self.cy
self.image2.cx = self.cx
self.image2.cy = self.cy
self.image.render(canvas, tick)
self.image2.render(canvas, tick)