diff --git a/examples/clock/client/clock.html b/examples/clock/client/clock.html new file mode 100644 index 0000000000..1a5e5d8ee9 --- /dev/null +++ b/examples/clock/client/clock.html @@ -0,0 +1,37 @@ + + SVG Clock Demo + + + + + + + + + + {{#with handData}} + + + + {{/with}} + + + {{#each hours}} + + {{/each}} + + + + + diff --git a/examples/clock/client/clock.js b/examples/clock/client/clock.js new file mode 100644 index 0000000000..4468819b08 --- /dev/null +++ b/examples/clock/client/clock.js @@ -0,0 +1,33 @@ +Meteor.setInterval(function () { + Session.set('time', new Date); +}, 1000); + +UI.body.helpers({ + + hours: _.range(0, 12), + + degrees: function () { + return 30 * this; + }, + + handData: function () { + var time = Session.get('time') || new Date; + return { hourDegrees: time.getHours() * 30, + minuteDegrees: time.getMinutes() * 6, + secondDegrees: time.getSeconds() * 6 }; + }, + + radial: function (angleDegrees, + startFraction, + endFraction) { + var r = 100; + var radians = (angleDegrees-90) / 180 * Math.PI; + + return { + x1: r * startFraction * Math.cos(radians), + y1: r * startFraction * Math.sin(radians), + x2: r * endFraction * Math.cos(radians), + y2: r * endFraction * Math.sin(radians) + }; + } +}); diff --git a/examples/clock/clock.css b/examples/clock/clock.css deleted file mode 100644 index 240903f650..0000000000 --- a/examples/clock/clock.css +++ /dev/null @@ -1,6 +0,0 @@ -/* CSS declarations go here */ - -line { - stroke-width: 3px; - stroke: black; -} diff --git a/examples/clock/clock.html b/examples/clock/clock.html deleted file mode 100644 index df0cd8b5d2..0000000000 --- a/examples/clock/clock.html +++ /dev/null @@ -1,30 +0,0 @@ - - SVG Clock - - - - {{> clock}} - - - diff --git a/examples/clock/clock.js b/examples/clock/clock.js deleted file mode 100644 index b885c830e9..0000000000 --- a/examples/clock/clock.js +++ /dev/null @@ -1,34 +0,0 @@ -if (Meteor.isClient) { - - Meteor.startup(function () { - Meteor.setInterval(function () { - Session.set('time', new Date); - }, 1000); - }); - - Template.clock.hours = _.range(0, 12); - - Template.clock.hourData = function () { - return { i: +this, - degrees: 30*this }; - }; - - Template.clock.handData = function () { - var time = Session.get('time') || new Date; - return { hourDegrees: time.getHours() * 30, - minuteDegrees: time.getMinutes() * 6, - secondDegrees: time.getSeconds() * 6 }; - }; - - Template.clock.radial = function (angleDegrees, startFraction, endFraction) { - var radius = 100; - - var radians = (angleDegrees - 90) / 180 * Math.PI; - return { - x1: radius * startFraction * Math.cos(radians), - y1: radius * startFraction * Math.sin(radians), - x2: radius * endFraction * Math.cos(radians), - y2: radius * endFraction * Math.sin(radians) - }; - }; -}