kaysonli / lucky-ball Goto Github PK
View Code? Open in Web Editor NEWA simple lottery program.
A simple lottery program.
stop: function() { this.running = false; TagCanvas.SetSpeed('myCanvas', this.getSpeed()); var total = this.awards[this.currentAward].count; this.result[this.currentAward] = this.result[this.currentAward] || []; var todo = total - this.result[this.currentAward].length; var N = +localStorage.getItem('batchNumber') || 20; var batchPlayers = []; for (var i = 0, ln = Math.min(N, todo, this.players.length); i < ln; i++) { var index = this.getRandomInt(0, this.players.length - 1); batchPlayers.push(this.players.splice(index, 1)[0]); } this.batchPlayers = batchPlayers; this.result.splice( this.currentAward, 1, this.result[this.currentAward].concat(batchPlayers) ); localStorage.setItem('players', JSON.stringify(this.players)); localStorage.setItem('result', JSON.stringify(this.result)); TagCanvas.Reload('myCanvas'); },
getRandomInt: function(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; },
源码中:这个中奖是随机的,和那个球转动没有什么关系?那个转动的球只是一个装饰么?
亲,非常感谢你的这个代码!
请问如何实现抽中的名单能及时显示在右边,谢谢!
我想基于您的项目进行二次开发,请问可以提供打包前的源代码吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.