lvangorysky / Ypaint

canvas draw picture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ypaint

引入

npm i ypaint

使用方法

import Paint from 'ypaint'

let paint = document.getElementById('canvas')
let newPaint = new Paint(paint);

方法参数

绘制矩形:

newPaint.init({
    drawWay: 'rectangle',
    lineWidth: 4, 
    color: 'red',
    radius: 2,
    rectangleType: 'stroke'
})

画笔工具:

newPaint.init({
    drawWay: 'pencil',
    lineWidth: 4, 
    color: 'red',
});

绘制箭头:

newPaint.init({
    drawWay: 'arrow',
    lineWidth: 4, 
    color: 'red',
})

绘制圆形:

newPaint.init({
    drawWay: 'circel',
    lineWidth: 4, 
    color: 'red', 
    fillColor: 'blue'
});

About

canvas draw picture


Languages

Language:HTML 53.5%Language:JavaScript 29.4%Language:TypeScript 13.3%Language:CSS 3.8%