prize-wheel

0.0.1 • Public • Published

prize-wheel

Prize wheel using canvas.

Demo

http://lab.miguelmota.com/prize-wheel

Download

npm install prize-wheel

Usage

Create a canvas element and give it an ID:

<canvas id="wheel"></canvas>

Initialize the wheel:

// Wheel settings object
var settings = {
  el: '#wheel', // Canvas ID
  members: ['Hamburgers', 'Tacos', 'Steak', 'Burritos'], // Array of members
  colors: ['#C7181D', '#FCB937', '#A1B836', '#371979'], // Background color of each member
  radius: 250 // wheel radius
};
 
// Create a wheel instance with settings
var wheel = new PrizeWheel(settings);
 
// Initialize the wheel
wheel.init();
 
// Spin the wheel with a callback after it is done
wheel.spin(function(member) {
  alert(member);
});

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i prize-wheel

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • miguelmota