Commit 3b9a8e67 authored by Deriabin,Peter P's avatar Deriabin,Peter P
Browse files

added sans.

parent 2c77f8ac
File added
#!/usr/bin/env python3
import os
import random
from PIL import Image
def transition(width: int, height: int, image_from: Image, image_to: Image):
images = ["sans.png", "sans2.png"]
images = [Image.open(os.path.dirname(os.path.abspath(__file__)) + "/../Images/%s" % name) for name in images]
image_idx = 0
image = images[0]
for offset_x in range(-image.width, width + 1):
target = image_to.copy()
coords = (
max(-offset_x, 0), 0,
min(width - offset_x, image.width), image.height
)
target.paste(image.crop(coords), (max(offset_x, 0), 0))
if (target.width - offset_x) > image.width:
if image_from:
coords = (
offset_x + image.width, 0,
image_from.width, image_from.height
)
target.paste(image_from.crop(coords), (offset_x + image.width, 0))
else:
# blank pixels...
for x in range(offset_x + image.width, target.width):
for y in range(target.height):
target.putpixel((x,y), 0)
yield target
if offset_x % 16 == 0:
image_idx += 1
image_idx %= len(images)
image = images[image_idx]
""" async def render(width: int=0, height: int=0):
i = Image.open('./Animations/sans.png')
yield i
# await asyncio.sleep(10)
await asyncio.sleep(1800) """
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment