<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="circle"></div>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://rawgit.com/kottenator/jquery-circle-progress/1.1.3/dist/circle-progress.js"></script>
</body>
</html>
body {
padding-top: 150px;
text-align: center;
}
$('.circle').circleProgress({
value: 1,
size: 200,
thickness: 10,
drawFrame: function(v) {
var ctx = this.ctx,
s = this.size,
r = this.radius * 0.9,
t = this.getThickness(),
da = Math.PI / 3,
dx = r / 10,
dy = r / 10 + 25,
lc = 'butt',
lj = 'miter';
this.lastFrameValue = v;
ctx.clearRect(0, 0, this.size, this.size);
ctx.lineWidth = t;
ctx.lineJoin = lj;
ctx.lineCap = lc;
function getX(angle) {
return r * (1 + Math.cos(angle));
}
function getY(angle) {
return r * (1 + Math.sin(angle));
}
var a1 = -Math.PI * 5 / 6 + da,
x1 = getX(a1) + dx,
y1 = getY(a1) + dy;
var a2 = -Math.PI / 6 + da,
x2 = getX(a2) + dx,
y2 = getY(a2) + dy;
var a3 = Math.PI / 2 + da,
x3 = getX(a3) + dx,
y3 = getY(a3) + dy;
// Draw "empty" path
ctx.save();
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.lineTo(x3, y3);
ctx.closePath();
ctx.strokeStyle = this.emptyFill;
ctx.stroke();
ctx.restore();
// Draw "filled" path
ctx.save();
ctx.beginPath();
var p0 = 0.96;
ctx.moveTo(
x1 * p0 + x3 * (1 - p0),
y1 * p0 + y3 * (1 - p0)
);
ctx.lineTo(x1, y1);
var p1 = v > 1 / 3 ? 1 : v * 3;
ctx.lineTo(
x2 * p1 + x1 * (1 - p1),
y2 * p1 + y1 * (1 - p1)
);
if (v > 1 / 3) {
var p2 = v > 2 / 3 ? 1 : v * 3 - 1;
ctx.lineTo(
x3 * p2 + x2 * (1 - p2),
y3 * p2 + y2 * (1 - p2)
);
}
if (v > 2 / 3) {
var p3 = v * 3 - 2;
ctx.lineTo(
x1 * p3 + x3 * (1 - p3),
y1 * p3 + y3 * (1 - p3)
);
}
if (v >= 1)
ctx.closePath();
ctx.strokeStyle = this.arcFill;
ctx.stroke();
ctx.restore();
}
});
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |