{"id":19998155,"url":"https://github.com/willnewii/json2canvas","last_synced_at":"2025-04-07T13:05:35.949Z","repository":{"id":34932129,"uuid":"191617597","full_name":"willnewii/json2canvas","owner":"willnewii","description":"通过json直接在canvas上绘制图像,支持小程序和浏览器.","archived":false,"fork":false,"pushed_at":"2023-01-06T02:52:18.000Z","size":1764,"stargazers_count":237,"open_issues_count":61,"forks_count":34,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T12:09:12.120Z","etag":null,"topics":["canvas","cax","weapp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willnewii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-12T17:39:34.000Z","updated_at":"2025-03-07T06:42:13.000Z","dependencies_parsed_at":"2023-01-15T10:38:52.454Z","dependency_job_id":null,"html_url":"https://github.com/willnewii/json2canvas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnewii%2Fjson2canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnewii%2Fjson2canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnewii%2Fjson2canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnewii%2Fjson2canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willnewii","download_url":"https://codeload.github.com/willnewii/json2canvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657275,"owners_count":20974344,"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","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":["canvas","cax","weapp"],"created_at":"2024-11-13T05:07:31.201Z","updated_at":"2025-04-07T13:05:35.923Z","avatar_url":"https://github.com/willnewii.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 概述\n\n\u003e 通过json直接在canvas上绘制图像.基于[cax](https://github.com/dntzhang/cax),借鉴(抄袭)了[mp_canvas_drawer](https://github.com/kuckboy1994/mp_canvas_drawer).比canvas_drawer多了图片圆角支持,圆形,缩放,分组等功能.文本支持动态高度,竖排.同时支持小程序和浏览器.\n\n## 预览\n![预览图](http://blog-res.mayday5.me/img/2019-07-01%2017.45.19.gif)\n\n- [demo-web](http://blog.mayday5.me/json2canvas/example/web/index.html)\n\n- 小程序demo\n```bash\ngit clone https://github.com/willnewii/json2canvas.git\n微信开发者工具导入项目 example/weapp/\n```\n\n## 功能说明\n- 支持缩放 如果设计稿是750,而画布只有375时.不需要任何换算,只需要将scale设置为0.5\n- 支持图片圆角\n- 支持圆型,矩形,矩形圆角(背景色支持线性渐变)\n- 文本支持竖排,长文本自动换行\n- [支持动态文本](https://github.com/willnewii/json2canvas/blob/master/doc/动态文本.md)\n- 支持分组(cax里很好用的一个功能)  [说明](https://github.com/dntzhang/cax/blob/master/README.CN.md)\n- 支持旋转\n\n## 小程序添加json2canvas组件\nrequire：SDKVersion\u003e=2.6.1\n小程序已经支持使用 npm 安装第三方包，详见 [npm 支持](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html?search-key=npm)\n```bash\n1.npm i json2canvas\n2.微信开发者工具-\u003e工具-\u003e构建npm\n3.在需要使用的界面引入Component\n{\n  \"usingComponents\": {\n    \"json2canvas\":\"/miniprogram_npm/json2canvas/index\"\n  }\n}\n```\n\n## [元素属性说明](https://github.com/willnewii/json2canvas/blob/master/doc/元素.md)\n\n## 借鉴和引用\n- [竖排计算 张鑫旭大神的博客](http://www.zhangxinxu.com/wordpress/?p=7362)\n- [coolzjy@v2ex 正则优化断行](https://regexr.com/4f12l)\n- [mp_canvas_drawer](https://github.com/kuckboy1994/mp_canvas_drawer)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillnewii%2Fjson2canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillnewii%2Fjson2canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillnewii%2Fjson2canvas/lists"}