{"id":27116543,"url":"https://github.com/shashi278/kivg","last_synced_at":"2025-10-08T14:24:11.424Z","repository":{"id":39714950,"uuid":"375427647","full_name":"shashi278/kivg","owner":"shashi278","description":"SVG path drawing and animation support in kivy application","archived":false,"fork":false,"pushed_at":"2025-05-03T11:39:05.000Z","size":627,"stargazers_count":35,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-17T01:12:29.249Z","etag":null,"topics":["hacktoberfest","kivy","python","svg","svg-animations","svg-images"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shashi278.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-06-09T16:52:23.000Z","updated_at":"2025-04-06T06:44:02.000Z","dependencies_parsed_at":"2025-04-18T17:47:08.672Z","dependency_job_id":"d836998d-c6a8-4c8b-9a33-d7cd3ab99173","html_url":"https://github.com/shashi278/kivg","commit_stats":null,"previous_names":["shashi278/kivg","shashi278/svg-anim-kivy"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/shashi278/kivg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shashi278%2Fkivg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shashi278%2Fkivg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shashi278%2Fkivg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shashi278%2Fkivg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shashi278","download_url":"https://codeload.github.com/shashi278/kivg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shashi278%2Fkivg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278957529,"owners_count":26075480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","kivy","python","svg","svg-animations","svg-images"],"created_at":"2025-04-07T05:29:03.315Z","updated_at":"2025-10-08T14:24:11.402Z","avatar_url":"https://github.com/shashi278.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Kivg\n*SVG path drawing and animation support in kivy application*\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/shashi278/kivg/.github%2Fworkflows%2Fpython-publish.yml) [![Python 3.6](https://img.shields.io/pypi/pyversions/kivymd)](https://www.python.org/downloads/release/python-360/) [![pypi](https://img.shields.io/pypi/v/kivg)](https://pypi.org/project/Kivg/) [![code size](https://img.shields.io/github/languages/code-size/shashi278/svg-anim-kivy)]() [![license](https://img.shields.io/github/license/shashi278/svg-anim-kivy)](https://github.com/shashi278/svg-anim-kivy/blob/main/LICENSE) [![downloads](https://img.shields.io/pypi/dm/kivg)](https://pypi.org/project/Kivg/) ![Pepy Total Downloads](https://img.shields.io/pepy/dt/kivg?label=Total%20Downloads)\n\n\n#\n\n## Features\n| **Path Drawing \u0026 filling** | **Shape Animation** |\n| :-------------: |:-------------:|\n| \u003cimg src=\"https://raw.githubusercontent.com/shashi278/svg-anim-kivy/main/demo/svg_demo.gif\" width=300\u003e | \u003cimg src=\"https://raw.githubusercontent.com/shashi278/svg-anim-kivy/main/demo/adv_svg_anim.gif\" width=300\u003e |\n\nNow you can take some of the advantages svg offers, in your kivy apps. Those are:\n- [x] Compact file size compare to other formats - reduced asset size\n- [x] Scalability - Draw them big or small\n- [x] Interactivity - Animations\n\n#\n\n## Install\n```bash\npip install kivg\n```\n\n## Usage Guide\n\nKivg helps you easily draw and animate SVG files in your Kivy applications.\n\n### Path Drawing and Filling\n\n```python\nfrom kivg import Kivg\n\ns = Kivg(my_widget)\n\n# call draw method with a `svg_file` name\ns.draw(\"github.svg\", fill=False, animate=True, anim_type=\"seq\")\n```\n\n#### Parameters:\n- **fill** : *Whether to fill the shape after drawing*. Defaults to `True`\n- **animate** : *Whether to animate drawing*. Defaults to `False`\n- **anim_type** : *Whether to draw in sequence or parallel. Available `\"seq\"` and `\"par\"`*. Defaults to `\"seq\"`\n- **line_width** : *Width of the path stroke*. Defaults to `2`\n- **line_color** : *Color of the path stroke in RGBA format*. Defaults to `[0, 0, 0, 1]`\n- **dur** : *Duration of each animation step in seconds*. Defaults to `0.02`\n\n#### Important:\n- Fill color would only work if it's in hex and inside `\u003cpath\u003e` tag. You must modify svg if it's not this way already.\n- Gradient is not yet supported - default to `#ffffff` if can't parse color\n\n#\n\n### Shape Animation\n\n```python\nfrom kivg import Kivg\n\ns = Kivg(my_widget)\n\nanim_config = [\n    { \"id_\":\"k\", \"from_\":\"center_x\", \"t\":\"out_back\",   \"d\":.4 },\n    { \"id_\":\"i\", \"from_\":\"center_y\", \"t\":\"out_bounce\", \"d\":.4 },\n    { \"id_\":\"v\", \"from_\":\"top\",      \"t\":\"out_quint\",  \"d\":.4 },\n    { \"id_\":\"y\", \"from_\":\"bottom\",   \"t\":\"out_back\",   \"d\":.4 }\n]\n\n# call shape_animate method with `svg_file` and an animation config list and optional callback\ns.shape_animate(\"text.svg\", anim_config_list=anim_config, on_complete=lambda *args: print(\"Completed!\"))\n```\n\n#### Animation Configuration:\n- **anim_config_list** : A list of dicts where each dict contain config for an `id`. Description of each key:\n    - `\"id_\"` : `id` of svg `\u003cpath\u003e` tag. It's required so each dict must contain `\"id_\"` key\n    - `\"from_\"` : Direction from which a path should grow. Accepted values `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"center_x\"`(grow from center along horizontal axis), `\"center_y\"`, and `None`(Draw without animation). Defaults to `None`.\n    - `\"t\"` : [Animation transition](https://kivy.org/doc/stable/api-kivy.animation.html?highlight=animation#kivy.animation.AnimationTransition). Defaults to `\"out_sine\"`.\n    - `\"d\"` : Duration of animation. It'll still in-effect if `\"from_\"` is set to `None`. Defaults to .3\n\n- **on_complete** (optional) : Function to call after entire animation is finished. It can be used to create looping animation\n\n#### Important:\n- You must add a unique `id` to each path element you want to animate\n- Dictionary order in the list is important - animations run in the sequence provided\n- Animations can be chained by using the on_complete callback for continuous effects\n\n## Project Structure\n\nThe project is organized into the following main components:\n\n```\nkivg/\n├── __init__.py         # Package entry point\n├── data_classes.py     # Data structures for animation contexts\n├── main.py             # Core Kivg class implementation\n├── mesh_handler.py     # Handles mesh rendering \n├── path_utils.py       # SVG path utilities\n├── svg_parser.py       # SVG parsing functionality\n├── svg_renderer.py     # SVG rendering engine\n├── version.py          # Version information\n├── animation/          # Animation subsystem\n│   ├── animation_shapes.py  # Shape-specific animations\n│   ├── handler.py           # Animation coordination\n│   └── kivy_animation.py    # Kivy animation file with some modifications\n└── drawing/            # Drawing subsystem\n    └── manager.py      # Drawing management\n```\n\n## Quick Start\n\n1. **Install the package**:\n   ```bash\n   pip install kivg\n   ```\n\n2. **Set up your Kivy widget**:\n   ```python\n    from kivy.app import App\n    from kivy.uix.widget import Widget\n    from kivg import Kivg\n\n    class MyWidget(Widget):\n        def __init__(self, **kwargs):\n            super(MyWidget, self).__init__(**kwargs)\n            self.size = (1024, 1024)\n            self.pos = (0, 0)\n\n    class KivgDemoApp(App):\n        def build(self):\n            widget = MyWidget()\n            self.kivg = Kivg(widget)\n            self.kivg.draw(\"icons/so.svg\", animate=True, line_color=[1,1,1,1], line_width=2)\n            return widget\n\n    if __name__ == \"__main__\":\n        KivgDemoApp().run()\n   ```\n\n3. **Try shape animations**:\n   ```python\n   # Configure animations for different shapes\n   animations = [\n       {\"id_\": \"shape1\", \"from_\": \"left\", \"t\": \"out_bounce\", \"d\": 0.5},\n       {\"id_\": \"shape2\", \"from_\": \"top\", \"t\": \"out_elastic\", \"d\": 0.3}\n   ]\n   self.kivg.shape_animate(\"path/to/your.svg\", anim_config_list=animations)\n   ```\n\n## Useful Tools\n\nFew links that I found useful for modifying few svg files in order to work with this library are:\n\n* https://itchylabs.com/tools/path-to-bezier/ - Convert SVG Path to Cubic Curves\n\n    Use it to convert SVG Arcs to Cubic Bezier. Make sure you paste the entire `path` in the textfield rather than only the arc section. Also you should provide path dimensions(`W` \u0026 `H`) on the website as your svg width and height(found under `\u003csvg\u003e` tag). You may also need to close each path, i.e. add `Z` at the end of new converted path.\n\n* https://codepen.io/thednp/pen/EgVqLw - Convert Relative SVG Path To Absolute Path\n    \n    Maybe useful when you want to split a single svg path into multiple paths for animation purpose. Paste the entire path. When splitting, make sure you close the previous path by adding a `Z` at the end in the path string.\n\n* https://jakearchibald.github.io/svgomg/ - SVG Optimizer\n    \n    Useful for cleaning up and optimizing SVG files to ensure compatibility.\n\n## Changelog\n\n**v1.1**\n* Fixed crashing when SVG size is not int\n\n**v1.0**\n* Shape animation feature added\n* Added `anim_type` in draw method\n\n**Earlier Changes**\n* Added option to draw image without animation, `animate=False`\n* Added option to draw empty or filled path, `fill=True` or `fill=False`\n\n## Contributing\n\n![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)\n\nWe welcome contributions! Here's how you can help:\n\n1. **Bug fixes**: If you find a bug, please open an issue or submit a pull request with a fix\n2. **Feature additions**: Have an idea for a new feature? Open an issue to discuss it\n3. **Documentation**: Improvements to documentation are always appreciated\n4. **Examples**: Add more example use cases to help others learn\n\nPlease make sure to test your changes before submitting a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/shashi278/svg-anim-kivy/blob/main/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshashi278%2Fkivg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshashi278%2Fkivg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshashi278%2Fkivg/lists"}