JSPM

canvas-scratch-card

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 73
  • Score
    100M100P100Q72972F
  • License MIT

scratch card plugin base on Canvas,Compatible with pc and mobile

Package Exports

  • canvas-scratch-card

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (canvas-scratch-card) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

canvas-scratch-card

scratch card plugin base on Canvas,Compatible with pc and mobile

how to use?

import scratchCard from 'canvas-scratch-card';
scratchCard.init({
  dom: document.getElementById('id'),
  r: 20, // radius default 20
  rate: 0.5, // when to call callback 0.1 - 1,
  image: 'https://xxxx.jpg', // <img> dom or url
  fillColor: '#b22', // fillColor, when this prop set, image will not render
  callback: () => {
    alert('haha');
  },
});

// reset
scratchCard.reset();

example

pc & mobile