weex-canvas
v1.0.2
Published
The js for weex canvas component
Downloads
10
Readme
weex-canvas
The js for weex canvas component.
How To use?
install it with
npm install weex-canvas
write weex code as below:
<template>
<container>
<canvas style="width:750;height:750;" id="canvas"></canvas>
</container>
</template>
<script>
var Canvas = require('weex-canvas');
module.exports = {
ready: function () {
var ctx = Canvas.getContext(this.$el('canvas'));
ctx.fillStyle = 'red';
ctx.fillRect(100, 100, 100, 100);
ctx.draw();
}
}
</script>
- run it
Current support API list
- ctx.clearRect
- ctx.fillRect
- ctx.beginPath
- ctx.closePath
- ctx.moveTo
- ctx.lineTo
- ctx.arc
- ctx.stroke
- ctx.fillStyle
- ctx.strokeStyle
- ctx.lineWidth
- ctx.globalAlpha
- ctx.translate
- ctx.rotate
- ctx.scale
- ctx.drawImage
- ctx.save
- ctx.restore