1.0.2 • Published 2 years ago

darwposter-npm v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

darwposter-npm

npm i darwposter-npm
import { buildPoster4Canvas } from 'darwposter-npm'
const blockList = [
  {
    type: 'img', // 绘制类型img图片,text文字
    value: bg, // 图片地址或者文案
    width: 80, // 元素的宽度
    height: 80, // 元素的高度
    posX: 100, // 元素的x坐标
    posY: 820, // 元素的y坐标
    radius: 50, // 图像的圆角
    avatorColor: 'red', // 头像边框颜色
  },
  {
    type: 'text',
    value: '文案',
    font: 24, // 字体大小
    posX: 50,
    textColor: 'red', // 字体颜色
    posY: 950,
  },
]

// width画布宽度
// height画布高度
// blockList 需要绘制海报的元素
const posterImg = await buildPoster4Canvas(width, height, blockList);