@monda/float
v1.0.0
Published
使用画布生成海报图
Readme
安装
npm install -D @monda/floatNumber使用
import { createPoster } from "@monda/poster"案例
const options = [
{
url: 'https://static-nk.liux.co/image8/134ff8b/2fae46aa00001101.png',
width: 260,
height: 390,
},
{
rect: [0, 270, 260, 390],
color: '#fff',
},
{
text: '商品标题abc123商品标题abc123商品标题abc123商品标题abc123',
color: '#222',
fontSize: 16,
maxWidth: 150,
maxRow: 2,
rowSpace: 5,
x: 10,
y: 295,
},
{
url: 'https://static-nk.liux.co/image8/134fffb/2fe6a84a00001101.png',
width: 80,
height: 80,
x: 170,
y: 290,
},
{
url: 'https://static-nk.liux.co/image8/134ff8b/2fae46aa00001101.png',
round: true,
width: 40,
height: 40,
x: 10,
y: 335,
},
{
text: '木有昵称',
color: '#222',
fontSize: 12,
x: 60,
y: 350,
},
{
text: '向您推荐',
color: '#888',
fontSize: 10,
x: 60,
y: 370,
},
{
text: '颂福心愿',
color: '#f40',
fontSize: 10,
x: 105,
y: 370,
}
];
document.getElementById('img').src = await createPoster(options)