1.0.4 • Published 6 years ago

extend-canvas v1.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

NPM

ExtendCanvas

Add some useful methods on CanvasRenderingContext2D.prototype

features

  • toLines: make long text to lines
  • wrapText: this method extend fillText,when fixed width it’ll automatic wrap text

example

warpText

import extCanvas from 'extend-canvas'
extCanvas()

let longText = 'this is long long long long long text'
let canvas = document.createElement('canvas')
canvas.width = 750
canvas.height = 1334
let context = canvas.getContext('2d')
context.fillStyle = '#000'
context.font = '48px PingFang SC'
context.textBaseline = 'hanging'
context.wrapText(longText, 79, 264, 592, 72)
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago