weex-canvas

1.0.2 • Public • Published

weex-canvas

The js for weex canvas component.

How To use?

  1. install it with npm install weex-canvas

  2. 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>
  1. run it

Current support API list

  1. ctx.clearRect
  2. ctx.fillRect
  3. ctx.beginPath
  4. ctx.closePath
  5. ctx.moveTo
  6. ctx.lineTo
  7. ctx.arc
  8. ctx.stroke
  9. ctx.fillStyle
  10. ctx.strokeStyle
  11. ctx.lineWidth
  12. ctx.globalAlpha
  13. ctx.translate
  14. ctx.rotate
  15. ctx.scale
  16. ctx.drawImage
  17. ctx.save
  18. ctx.restore

Readme

Keywords

Package Sidebar

Install

npm i weex-canvas

Weekly Downloads

0

Version

1.0.2

License

Apache-2.0

Last publish

Collaborators

  • steel1990