UNPKG

soma.js

Version:

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

41 lines (35 loc) 1.31 kB
// Generated by CoffeeScript 1.6.2 (function() { (function(clock) { "use strict"; return clock.AnalogView = (function() { function AnalogView(target, face, needleSeconds, needleMinutes, needleHours) { var canvas, context, radius, tick, _this = this; this.element = target; radius = 250; canvas = document.createElement('canvas'); context = canvas.getContext('2d'); canvas.width = canvas.height = radius; target.appendChild(canvas); face.initialize(radius); needleSeconds.initialize(radius); needleMinutes.initialize(radius); needleHours.initialize(radius); tick = function(time) { face.draw(context); needleSeconds.update(time.seconds); needleSeconds.draw(context); needleMinutes.update(time.minutes, time.seconds); needleMinutes.draw(context); needleHours.update(time.hours, time.minutes, time.seconds); return needleHours.draw(context); }; this.update = tick.bind(this); } AnalogView.prototype.dispose = function() { return this.element.removeChild(this.element.firstChild); }; return AnalogView; })(); })(window.clock = window.clock || {}); }).call(this);