Giter VIP home page Giter VIP logo

txbb-scratch's Introduction

Txbb.Scratch

同学帮帮 h5 刮刮卡组件,简洁、无依赖,支持 globals 和 amd 两种调用方式。

暂时只能用在移动端

使用方法

<div id="J-Scratch"></div>
var scratchInstance = Txbb.Scratch.attach(element, options);

element

需要初始化的 容器 元素,canvas 元素会被添加进去。

var scratchInstance = Txbb.Scratch.attach(document.querySelector('#J-Scratch'), options);

options

  • bg (type: String): canvas 所在容器的背景颜色
  • fg (type: String): canvas 元素的颜色,即刮刮卡的颜色
  • middle (type: String): 刮完奖之后显示的元素,可以是 html 也可以是纯字符串
  • size (type: Number): 默认 20, 刮一下的半径
  • onEnd (type: Function): 刮完奖的回调函数

实例方法

  • reset: scratchInstance.reset(options) 重置刮刮卡,重置方法传入 options 可以改变实例化时的 options

txbb-scratch's People

Contributors

lpgray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.