Ubuntu Pastebin

Paste from rarara at Sun, 9 Aug 2015 07:10:35 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
        function drawProgressCircle(ctx, progress) {

            var centreX    = width / 2
            var centreY    = width / 2
            var lineWidth  = diameter / 40
            // to start at top
            var startAngle = 1.5 * Math.PI

            ctx.clearRect(0, 0, height, width);
            ctx.beginPath();
            ctx.fillStyle = "black";
            ctx.lineWidth = lineWidth;
            ctx.lineCap   = "round";
            ctx.moveTo(centreX, centreY - diameter / 2);
            // ctx.moveTo(centreX, 0);
            ctx.arc(centreX, centreY, diameter / 2 - lineWidth / 2, startAngle,
                    startAngle + 2 * progress * Math.PI, false);
            ctx.stroke();
            ctx.closePath();
        }
Download as text