1.0.3 • Published 5 years ago

watermask-lib v1.0.3

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

A library for watermasking web pages by canvas.

Screenshot

font-repeat font-single image-repeat image-single

Install

CDN

<script src="https://unpkg.com/watermask-lib@1.0.3/dist/watermask.min.js"></script>

npm

npm install watermask --save

Usage

font

new WaterMask({
    font: 'Baidu百度'
})

image

new WaterMask({
    image: 'xxx.png'
})

Full options

new WaterMask({
    font: "",
    fontType: 'Microsoft YaHei',
    size: 24,
    container: container,
    color: "#333",
    alpha: 0.2,
    rotate: 340,
    scale: 1,
    startX: 20,
    startY: 20,
    rows: 10,
    cols: 10,
    xGap: 200,
    yGap: 100,
    image: '',
    repeat: true
})

Options

KeyTypeDefaultDescription
containerobjectdocument.querySelector("#watermask")
fontstringRender font, required if image property is undefined
fontTypestringMicrosoft YaHei
sizenumber24Fontsize
imagestringRender image, required if font property is undefined. Priorit to font property
colorstring#333
alphanumber0.2Global canvas transparency
rotatenumber340deg
scalenumber1
repeatbooleantrueFont or image will be repeat in x and y axis
startXnumber20px, will be used only when repeat property is true
startYnumber20px, will be used only when repeat property is true
rowsnumber10
colsnumber10
xGapnumber200px, will be used only when repeat property is true
yGapnumber100px, will be used only when repeat property is true
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago