1.2.2 • Published 6 years ago

touchkit v1.2.2

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

Touchkit.js

Example

Git

Download

Introduction

This toolkit is built on mtouch.js and mcanvas.js. Use it, you can build a gesture project quickly and get a image automatically. concerned less and do more!

Installation

  • You can download the latest version from the GitHub
  • use a npm CDN.
  • Or you can install via npm:
npm install touchkit --save

Basic Usage

The idea of touchkit is that init create a touch box firstly, and then use tk.background() add the background and use tk.add() add the touch-element into the touch box, finally, export a composite image by tk.exportImage(). The image is what you see in touch box.

the simple example, see the document for more details.

// init create touch box
new Touchkit('.js-par')

// add background image
// type: contain/crop
// the background-image will place at the bottom of touch-box
.background({
    image:'./images/p2.jpg',
    type:'contain',
})

// add operable element to touch box
.add({
    image:`images/ear.png`,
    width:'100px',
    use:{
        drag:true,
        pinch:true,
        rotate:true,
        singlePinch:true,
        singleRotate:true,
    },
    pos:{
        x:116,
        y:45,
        scale:1.25,
        rotate:2.63,
    },
}).add({
    image:`images/neck.png`,
    width:100,
    limit:true,
    close:true,
    use:'all',
    pos:{
        x:0,
        y:0,
        scale:1,
        rotate:0,
    },
})

// export a image contain all elements what you see in touch box
.exportImage(b64=>{
   console.log(b64);
})

document

Engligh | 中文版

License

MIT

1.2.2

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago