A complete Python port of the official Material Design 3 shape system from Android. It includes rounded polygon generation, shape morphing, and smooth transitions based on Google's original Java source.
Uses both ThorVG and PyCairo for 2D graphics rendering. Both backends return RGBA bytes of shapes. In ThorVG, it uses a centralized engine with multi-threading to maximize performance. A Kivy widget is already included.
The materialshapes.renderer module supports two backends:
- ThorVG: Uses
thorvg-pythonbindings. - PyCairo: Uses
pycairofor rendering.
Both backends are accessible through the render function.
There is no separate documentation yet.
The examples serve as the documentation and cover all major features. Check them out to understand usage and integration.
You can install the core library, but you must install at least one rendering backend:
# To use ThorVG (Recommended for performance)
pip3 install "materialshapes[thorvg]"
# To use Cairo
pip3 install "materialshapes[cairo]"
# To install both
pip3 install "materialshapes[all]"File: kivy.py
Run using:
python3 -m examples.kivy
vid.mp4
File: loading_indicator.py
Run using:
python3 -m examples.loading_indicator
