1.0.3 • Published 1 year ago

scratch-win-react v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

👆 Scratch Card React

1.Installation

npm install --save scratch-win-react
import { useRef } from 'react';
import ScratchCard from 'scratch-win-react';

2.Usage

const ref = useRef(null);
const finishScrashHandler = () => console.log('event call on finish=====>>');
<ScratchCard ref={ref} width={250} height={250} brushSize={20} finishPercent={50} onComplete={() => finishScrashHandler()} image="https://raw.githubusercontent.com/anmolsukki/scratch-win-react/master/src/coupon.png">
  <p>Play & Win Game</p>
</ScratchCard>

Props

PropDefaultTypeDescription
width-NumberWidth of the scratch card in pixels
height-NumberHeight of the scratch card in pixels
image-StringURL or path to the image to be displayed on the scratch card
brushSize-NumberBrush Size of the scratch card in pixels
brushCursorarrowStringURL or path to the image to be displayed on the scratch card
finishPercent-NumberPercentage of the scratch card to be covered for the final layer
onComplete-FunctionCallback function to be executed when the scratch card is completed

Note: Custome Cursor Example

brushCursor={"url('https://raw.githubusercontent.com/anmolsukki/scratch-win-react/master/src/brush-paint.png'),auto"}

----- OR ----

brushCursor={"pointer"}

Hi there, I'm Anmol 👋

CodeSandbox    Discord    Linkedin    facebook    twitter    Instagram    slack    stackoverflow

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago