0.0.1 • Published 7 years ago

prize-wheel v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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