forked from kkuramitsu/anime2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Anpanman072.py
23 lines (18 loc) · 979 Bytes
/
Anpanman072.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from anime2021.anime import AShape,test_shape,ACanvas,Image
!wget https://pics.prcm.jp/64eda603621c9/82347972/png/82347972.png
class RollingAnpanman(AShape):
color: any
def __init__(self, width=100, height=None, cx=None, cy=None, image='82347972.png'):
AShape.__init__(self, width, height, cx, cy)
if image.startswith('https://pics.prcm.jp/64eda603621c9/82347972/png/82347972.png'):
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-100), int(oy)), pic)
canvas.image.paste(pic, (int(ox), int(oy)), pic)
canvas.image.paste(pic, (int(ox+100), int(oy)), pic)
canvas.image.paste(pic, (int(ox), int(oy+100)), pic)
canvas.image.paste(pic, (int(ox), int(oy-100)), pic)