var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
var cw=canvas.width;
var ch=canvas.height;
var PI=Math.PI;
var PI2=PI*2;
var wheel={
cx:cw/2,
cy:ch/2,
radius:Math.min(cw,ch)/2-20,
startAngle:PI/4,
angle:PI/4,
draw:function(){
ctx.translate(this.cx,this.cy);
ctx.rotate(this.angle);
ctx.clearRect(0,0,cw,ch);
ctx.beginPath();
ctx.arc(0,0,this.radius,0,PI2);
ctx.fillStyle='skyblue';
ctx.strokeStyle='lightgray';
ctx.lineWidth=3;
ctx.fill();
ctx.stroke();
ctx.fillStyle='red';
ctx.font='18px verdana';
ctx.textBaseline='middle';
ctx.fillText('You Win!',40,0);
ctx.setTransform(1,0,0,1,0,0);
ctx.beginPath();
ctx.moveTo(cw/2,ch/2);
ctx.lineTo(cw/2+30,ch/2);
ctx.strokeStyle='green';
ctx.stroke();
},
}
var tl=TweenLite.to(wheel,5,{
paused:true,
angle:PI2*2,
ease:"Quart.easeOut",
onUpdate:function(){this.target.draw();},
onComplete:function(){console.log('complete',wheel);}
}
);
wheel.draw();
$('#play').click(function(){ tl.play(); });
$('#replay').click(function(){ tl.restart(); });
body{ background-color: ivory; }
#canvas{border:1px solid red;}
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenLite.min.js"></script>
<button id=play>Play</button>
<button id=replay>Replay</button>
<br><canvas id="canvas" width=300 height=300></canvas>