GithubHelp home page GithubHelp logo

teng2015 / scratchcard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from masth0/scratchcard

0.0 1.0 0.0 273 KB

ScratchCard is a library javascript to generate scratch card (HTML5, canvas) in modern browsers with touch events support.

Home Page: https://masth0.github.io/ScratchCard/

License: MIT License

CSS 8.06% JavaScript 58.50% HTML 33.44%

scratchcard's Introduction

ScratchCard

ScratchCard is a library javascript to generate scratch card (HTML5, canvas) in modern browsers with touch events support. Here the demo page: [DEMO] (https://masth0.github.io/ScratchCard/)

Options

  • canvasId : Id string of canvas
  • canvasWidth : Canvas width
  • canvasHeight : Canvas height
  • imageBackground : Path to background image
  • pictureOver : Path to foreground image
  • radius : Radius of clear zone
  • nPoints : Number of points generate inside the clear zone
  • pointSize : {
    x : Number,
    y : Number
    }
  • percent : When clear the canvas after 'mouseup' event
  • callback : Function executed after canvas clearing
  • cursor : {
    png : // Path to the .png for modern browsers
    x : // Move position x
    y : // Move position y
    cur : // Path to the .cur for internet explorer
    }

Javascript init

var scratch = new Scratch({
	canvasId: 'js-scratch-canvas',
	imageBackground: '/path/to/image',
	pictureOver: '/path/to/image',
	canvasWidth: 250,
	canvasHeight: 250,
	cursor: {
		png: '/path/to/cursor.png',
		cur: '/path/to/cursor.cur',
		x: '20',
		y: '17'
	},
	radius: 20,
	nPoints: 100,
	percent: 50,
	callback: function () {
		alert('I am Callback.');
	},
	pointSize: { x: 3, y: 3}
});

MIT License. © Masth0

scratchcard's People

Contributors

masth0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.