Coder Social home page Coder Social logo

longshaoye / gb-canvas-turntable Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 73.0 11 KB

适用于移动端的Canvas绘制可配置的转盘抽奖

Home Page: http://blog.givebest.cn/GB-canvas-turntable.html

License: MIT License

HTML 15.24% CSS 11.80% JavaScript 72.96%

gb-canvas-turntable's Introduction

GB-canvas-turntable


简介

适用于移动端的Canvas绘制可配置的转盘抽奖

使用

Browser

<link rel="stylesheet" href="css/GB-canvas-turntable.css">
<script src="js/GB-canvas-turntable.js"></script>

普通

gbTurntable.init({
    id: 'turntable',
    config: function(callback){
        // 获取奖品信息
        callback && callback(['1元红包','2元红包','3元红包','4元红包','5元红包','6元红包']);    
    },
    getPrize: function(callback) {
        // 获取中奖信息
        var num = Math.random() * 6 >>> 0,   //奖品ID
            chances = num;  // 可抽奖次数
            callback && callback([num, chances]);   
    },
    gotBack: function(data) {
        alert('恭喜抽中' + data);
    }
});

感谢他们

演示网页排版来自: https://github.com/sofish/typo.css

License

MIT © 2016 givebest

gb-canvas-turntable's People

Contributors

givebest avatar

Stargazers

 avatar

Watchers

 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.