Skip to content

Commit 354a908

Browse files
committed
- Fix async rendering
- Sharing loaded rlottie library between class instances - Pillow is now optional dependency - Add example for using async rendering - Fix sphinx docstrings - Fix permissions - Add shebangs
1 parent 00ac961 commit 354a908

6 files changed

Lines changed: 120 additions & 82 deletions

File tree

example/example.py

100644100755
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python3
12
from rlottie_python import LottieAnimation
23
from PIL import Image
34

@@ -47,17 +48,25 @@
4748
im = Image.frombuffer("RGBA", (width, height), buffer, "raw", "BGRA")
4849
im.save("test3.png")
4950

51+
# Directly get buffer, async
52+
anim.lottie_animation_render_async(frame_num=50)
53+
# You may do other other tasks in between
54+
buffer = anim.lottie_animation_render_flush()
55+
width, height = anim.lottie_animation_get_size()
56+
im = Image.frombuffer("RGBA", (width, height), buffer, "raw", "BGRA")
57+
im.save("test4.png")
58+
5059
# Loading JSON string with from_data()
5160
with open(json_file) as f:
5261
data = f.read()
5362

5463
# Alternative way of creating instance of LottieAnimation
5564
with LottieAnimation.from_data(data=data) as anim:
5665
# Saving frame with save_frame
57-
anim.save_frame("test4.png", frame_num=30)
66+
anim.save_frame("test5.png", frame_num=30)
5867

5968
# Saving animation with save_animation
6069
with LottieAnimation.from_tgs(path=tgs_file) as anim:
61-
anim.save_animation("test5.apng")
62-
anim.save_animation("test6.gif")
63-
anim.save_animation("test7.webp")
70+
anim.save_animation("test6.apng")
71+
anim.save_animation("test7.gif")
72+
anim.save_animation("test8.webp")

example/sample.json

100755100644
File mode changed.

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

rlottie_python/__init__.py

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
#!/usr/bin/env python3
12
"""rlottie-python"""
2-
__version__ = "1.2.0"
3+
__version__ = "1.2.1"
34

45
from .rlottie_wrapper import LottieAnimation

0 commit comments

Comments
 (0)