I'm currently working on a spinning wheel. But I want to change a red background-color to an background-image http://www.dougtesting.net/winwheel. Does somebody know how I can fix this. It has to be javascript and not jQuery. The code has to be in the function 'drawRouletteWheel'.
https://jsfiddle.net/9wo2krh8/
function drawRouletteWheel() {
var canvas = document.getElementById("wheelcanvas");
if (canvas.getContext) {
var outsideRadius = 250;
var textRadius = 125;
var insideRadius = 0;
surface = canvas.getContext("2d");
surface.font = 'bold 25px sans-serif';
for(var i = 0; i < 8; i++) {
var angle = startAngle + i * arc;
surface.fillStyle = 'red';
surface.beginPath();
surface.arc(250, 250, outsideRadius, angle, angle + arc, false);
surface.arc(250, 250, insideRadius, angle + arc, angle, true);
surface.fill();
surface.save();
surface.fillStyle = "yellow";
surface.translate(250 + Math.cos(angle + arc / 2) * textRadius, 250 + Math.sin(angle + arc / 2) * textRadius);
surface.rotate(angle + arc / 2 + Math.PI / 2);
var text = restaraunts[i];
surface.fillText(text, -surface.measureText(text).width / 2, 0);
surface.restore();
}
}