JSFiddle - React, Tailwind, and code Playground

by Neal

HTML

<div id="game">
    <div id="tick">⇩</div>
    <img id="wheel" src="http://i.imgur.com/R7JYazp.png" data-rotation="0">
</div>

CSS

@import url(http://fonts.googleapis.com/css?family=Changa+One);
 #game {
    font-family:'Changa One' serif;
}
#wheel {
    top: 0;
    left: 0;
    width: 500px;
    -moz-border-radius: 250px;
    -webkit-border-radius: 250px;
    border-radius: 250px;
    -webkit-transition: -webkit-transform 0.5s linear;
    -moz-transition: -moz-transform 0.5s linear;
    -opera-transition: -opera-transform 0.5s linear;
    -ms-transition: transform 0.5s linear;
}
#tick {
    margin-left: 244px;
    font-family: Arial;
    font-size: 14pt;
}
#display {
    background-color: #43759f;
    padding: 1em 2em;
    text-align: center;
    border-radius: 40px;
    border: 4px double #fff;
}
#display div.word {
    display: inline-block;
}
#display div.wordLetter {
    display: block;
    width: 50px;
    height: 65px;
    margin: 2px;
    border: 2px solid #43759f;
    float: left;
    line-height: 65px;
    font-size: 40px;
}
#display div.wordLetter.letter {
    border-color: #eee;
}
#playArea {
    clear: both;
}
#playArea button {
    text-transform: uppercase;
    z-index: 1000;
    border: 4px double #fff;
    background-color: #43759f;
    padding: 6px 14px;
    color: white;
    font-family: inherit;
    font-size: 12pt;
}
#playArea #moneyArea {
    float: right;
    position: relative;
    padding: 10px;
    border: 2px black solid;
    width: 200px;
    margin: 5px;
    font-size: 14pt;
}
#playArea #moneyArea #money {
}
.clear {
    clear: both;
}

JavaScript

var Wheel = (function () {
    var wheel = document.getElementById('wheel'),
        wheelValues = [5000, 600, 500, 300, 500, 800, 550, 400, 300, 900, 500, 300, 900, 0, 600, 400, 300, -2, 800, 350, 450, 700, 300, 600],
        spinTimeout = false,
        spinModifier = function () {
            return Math.random() * 10 + 20;
        },
        modifier = spinModifier(),
        slowdownSpeed = 0.5,
        prefix = (function () {
            if (document.body.style.MozTransform !== undefined) {
                return "MozTransform";
            } else if (document.body.style.WebkitTransform !== undefined) {
                return "WebkitTransform";
            } else if (document.body.style.OTransform !== undefined) {
                return "OTransform";
            } else {
                return "";
            }
        }()),
        degreeToRadian = function (deg) {
            return deg / (Math.PI * 180);
        };

    function Wheel() {};

    Wheel.prototype.rotate = function (degrees) {
        var val = "rotate(-" + degrees + "deg)";
        if (wheel.style[prefix] != undefined) wheel.style[prefix] = val;
        var rad = degreeToRadian(degrees % 360),
            filter = "progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=" + rad + ", M12=-" + rad + ", M21=" + rad + ", M22=" + rad + ")";
        if (wheel.style["filter"] != undefined) wheel.style["filter"] = filter;
        wheel.setAttribute("data-rotation", degrees);
    };

    Wheel.prototype.spin = function (callback, amount) {
        var _this = this;
        clearTimeout(spinTimeout);
        modifier -= slowdownSpeed;
        if (amount === undefined) {
            amount = parseInt(wheel.getAttribute('data-rotation'));
        }
        this.rotate(amount);
        if (modifier > 0) {
            spinTimeout = setTimeout(function () {
                _this.spin(callback, amount + modifier);
            }, 1000 / 5);
        } else {
            var dataRotation =...