// Enable 'Set Current Time' in Settings -> Communications before sending // The last time that we displayed var lastTime = "00:00"; // If animating, this is the interval's id var animInterval; // Load a bigger font for seconds/time require("Font8x12").add(Graphics); /* Get array of lines from digit d to d+1. n is the amount (0..1) maxFive is true is this digit only counts 0..5 */ function getLines(d, n, maxFive) { var r = Math.PI*n/2; switch (d) { case "0": return [ [n,0,1,0], [1,0,1,1], [1,1,1,2], [n,2,1,2], [n,1,n,2], [n,0,n,1]]; case "1": return [ [1-n,0,1,0], [1,0,1,1], [1-n,1,1,1], [1-n,1,1-n,2], [1-n,2,1,2]]; case "2": return [ [0,0,1,0], [1,0,1,1], [0,1,1,1], [0,1+n,0,2], [1,2-n,1,2], [0,2,1,2]]; case "3": return [ [0,0,1-n,0], [0,0,0,n], [1,0,1,1], [0,1,1,1], [1,1,1,2], [n,2,1,2]]; case "4": return [ [0,0,0,1], [1,0,1-n,0], [1,0,1,1-n], [0,1,1,1], [1,1,1,2], [1-n,2,1,2]]; case "5": return maxFive ? [ // 5 -> 0 [0,0,0,1], [0,0,1,0], [n,1,1,1], [1,1,1,2], [0,2,1,2], [0,2,0,2], [1,1-n,1,1], [0,1,0,1+n]] : [ // 5 -> 6 [0,0,0,1], [0,0,1,0], [0,1,1,1], [1,1,1,2], [0,2,1,2], [0,2-n,0,2]]; case "6": return [ [0,0,0,1-n], [0,0,1,0], [n,1,1,1], [1,1-n,1,1], [1,1,1,2], [n,2,1,2], [0,1-n,0,2-2*n]]; case "7": return [ [0,0,0,n], [0,0,1,0], [1,0,1,1], [1-n,1,1,1], [1,1,1,2], [1-n,2,1,2], [1-n,1,1-n,2]]; case "8": return [ [0,0,0,1], [0,0,1,0], [1,0,1,1], [0,1,1,1], [1,1,1,2], [0,2,1,2], [0,1,0,2-n]]; case "9": return [ [0,0,0,1], [0,0,1,0], [1,0,1,1], [0,1,1-n,1], [0,1,0,1+n], [1,1,1,2], [0,2,1,2]]; case ":": return [ [0.4,0.4,0.6,0.4], [0.6,0.4,0.6,0.6], [0.6,0.6,0.4,0.6], [0.4,0.4,0.4,0.6], [0.4,1.4,0.6,1.4], [0.6,1.4,0.6,1.6], [0.6,1.6,0.4,1.6], [0.4,1.4,0.4,1.6] ]; } return []; } /* Draw a transition between lastText and thisText. 'n' is the amount - 0..1 */ function draw(lastText,thisText,n) { var x = 1; // x offset var y = 10; // y offset var s = 16; // character size g.clear(); for (var i=0;i=1) { n=1; clearInterval(animInterval); animInterval=0; } draw(l,t,n); }, 50); lastTime = t; } function onInit() { setInterval(showTime, 1000); } save();