xlfsummer / mp-painter

声明式地创建适用于 uniapp, 原生微信小程序和原生H5的 canvas 海报
https://mp-painter.xlf-summer.cn/
MIT License
65 stars 6 forks source link
canvas miniprogram poster uniapp

mp-painter

npm size Test & Build

代码提示:
代码提示演示

安装

npm install mp-painter --save

# 安装 beta 版
npm install mp-painter@next --save

Hello World

<template>
    <canvas canvas-id="canvas"></canvas>
</template>
import Painter from "mp-painter";

// onReady 中
let painter = new Painter(uni.createCanvasContext("canvas"));
await painter.draw({
    type: "text",
    color: "#f33",
    fontSize: 60, // = 60rpx
    content: "Hello World" //绘制的文本
});

示例&文档

tips

目前,示例网址疑似被DNS污染无法访问,若要访问,请在 host 中增加记录:

185.199.108.153  mp-painter.xlf-summer.cn