Skip to content

Latest commit

 

History

History
64 lines (39 loc) · 1.76 KB

File metadata and controls

64 lines (39 loc) · 1.76 KB

materialshapes-python

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.

Rendering Backends

The materialshapes.renderer module supports two backends:

  • ThorVG: Uses thorvg-python bindings.
  • PyCairo: Uses pycairo for rendering.

Both backends are accessible through the render function.

Material Design Shape System

Docs

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.

Install

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]"

Examples

File: kivy.py

Run using:

python3 -m examples.kivy
vid.mp4

File: loading_indicator.py

Run using:

python3 -m examples.loading_indicator
vid.mp4