canvaslayer.js
This is an external method of jQuery,combines the functions of jcanvas.canvas adds multiple layers,Support single layer drag, zoom, rotation.Mainly for handheld mobile devices,commonly used in the addition of external multi-images in the canvas, the scaling threshold is between 0.1 and 5.Please be careful to the canvas own requirements and content limits when using.
-
There must be a jQuery dependency package in the module,or introduce a jQuery file in the html page script.
version: jQuery 1.4 +
. -
In order to achieve good device compatibility, the js startup file can add the
screen-pl
requirement module. -
System Support: Mobile browser kernel Android4.4+ 、ios ;Pc browser kernel webkit、Chrome、Gecko...
Install
npm install canvaslayer --save
Usage
Add the requirement JS library file to the code,Provide three parameters, and is a required argument [obj,imgname,imgsrc]
.obj is a jQuery canvas object,imgname is the unique name to add the image layer, and is a string type, imgsrc is the source to add the image layer and is a string type. rotation is also supported,default off, open need to add the fourth parameter boolean.
JavaScript:
let canvaslayer= require('canvaslayer');
let cvs= $('canvas');
canvaslayer(cvs,imgname,imgsrc);
html:
<body>
<canvas width="300" height="150"></canvas>
</body>