mehulcs / nativescript-scratchview

Nativescript plugin to implement scratching functionality
Apache License 2.0
3 stars 0 forks source link

Nativescript Scratch View (Android only)

Nativescript plugin to implement scratch card functionality.

Screenshot of Android

Installation

Run the following command from the root of your project:

tns plugin add nativescript-scratchview

Usage

You need to add xmlns:sv="nativescript-scratchview" to your page tag, and then simply use <sv:ScratchView> in order to add the widget to your page.

<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" xmlns:sv="nativescript-scratchview">
  <GridLayout rows="*" columns="*">
    <sv:ScratchView  id="scratchView" height="250"  width="250"  strokeWidth="10" revealed="{{revealed}}"  percentRevealed="{{percentRevealed}}">
      <Image  height="250"  width="250"  stretch="aspectFill"  src="https://github.com/mehulcs/nativescript-scratchview/raw/master/~/images/back.jpg"></Image>
      <Image  height="250"  width="250"  stretch="aspectFill"  src="https://github.com/mehulcs/nativescript-scratchview/raw/master/~/images/scratch.jpg"></Image>
    </sv:ScratchView>
  </GridLayout>
</Page>

API

Property Default Description
strokeWidth 10 Scratching stroke width

Events

Methods

License

Apache License Version 2.0, January 2004