UNPKG

soma.js

Version:

soma.js is a javascript framework created to build scalable and maintainable applications.

88 lines (76 loc) 2.63 kB
// Generated by CoffeeScript 1.6.2 (function() { (function(clock) { "use strict"; return clock.FaceView = (function() { function FaceView() { this.radius = 0; this.center = 0; } FaceView.prototype.initialize = function(radius) { this.radius = radius / 2 - 5; return this.center = radius / 2; }; FaceView.prototype.draw = function(context) { context.save(); context.clearRect(0, 0, this.center * 2, this.center * 2); context.lineWidth = 4.0; context.strokeStyle = '#015666'; context.beginPath(); context.arc(this.center, this.center, this.radius, 0, Math.PI * 2, true); context.closePath(); context.stroke(); this.drawDots(context); this.drawHourDots(context); this.drawCenter(context); return context.restore(); }; FaceView.prototype.drawCenter = function(context) { context.fillStyle = '#015666'; context.beginPath(); context.arc(this.center, this.center, 5, 0, Math.PI * 2, false); context.closePath(); return context.fill(); }; FaceView.prototype.drawDots = function(context) { var distance, i, theta, x, y, _results; theta = 0; distance = this.radius * 0.9; context.lineWidth = 0.5; context.strokeStyle = '#04859D'; i = 0; _results = []; while (i++ < 60) { theta = theta + (6 * Math.PI / 180); x = this.center + distance * Math.cos(theta); y = this.center + distance * Math.sin(theta); context.beginPath(); context.arc(x, y, 1, 0, Math.PI * 2, true); context.closePath(); _results.push(context.stroke()); } return _results; }; FaceView.prototype.drawHourDots = function(context) { var distance, i, theta, x, y, _results; theta = 0; distance = this.radius * 0.9; context.lineWidth = 5.0; context.strokeStyle = '#137'; i = 0; _results = []; while (i++ < 60) { theta = theta + (30 * Math.PI / 180); x = this.center + distance * Math.cos(theta); y = this.center + distance * Math.sin(theta); context.beginPath(); context.arc(x, y, 1, 0, Math.PI * 2, true); context.closePath(); _results.push(context.stroke()); } return _results; }; FaceView.prototype.dispose = function() {}; return FaceView; })(); })(window.clock = window.clock || {}); }).call(this);