hextris/main.js

36 lines
756 B
JavaScript
Raw Normal View History

// main thing here
window.requestAnimFrame = (function(){
2014-05-17 15:11:54 +00:00
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
(function animloop(){
requestAnimFrame(animloop);
render();
})();
function render() {
requestAnimFrame(animloop);
2014-05-17 15:11:54 +00:00
drawClock(10, 10, 0, 6);
}
function drawClock(x, y, sides, sideLength, theta) {
ctx.beginPath();
ctx.moveTo(0, sideLength);
for (var i = 0; i < sides; i++) {
var coords = rotatePoint(x, y, degToRadians(60));
ctx.lineTo(coords.x, coords.y);
ctx.moveTo(coords.x, coords.y);
}
ctx.stroke();
}
function degToRadians(degrees) {
return ((Math.PI) / 180) * degrees;
}f