REBOL [ Title: "REBOL Time" Version: 1.0.0 Author: "Carl Sassenrath" Purpose: { The basic analog "hello world" clock in a page of code. Of course, you can improve on it. Just keep your version small and simple. } needs: [1.3.0] ] rad: 100 cen: 150x150 hands: reduce [rad * .8 rad] bin: find ctx-viewtop to-set-word 'reblet-icon img: load bin/3 ; The draw block: dr-blk: compose [ pen coal line-cap round line-width 5 fill-pen white circle cen (rad + 30) image img 126x64 line-width 3 ] trig: func [radius deg] [ as-pair radius * sine deg radius * negate cosine deg ] ; Draw tic marks: for deg 0 359 6 [ xy1: cen + trig rad + 8 deg r: rad + pick [20 14] zero? mod deg 30 xy2: cen + trig r deg append dr-blk reduce ['line xy1 xy2] ] ; Draw hands: plot: func [hand deg][ rad: pick hands hand = hour-at change hand reduce ['line cen cen + trig rad deg * 6] ] ; Setup hand draw block: append dr-blk [pen black line-cap round line-width 6] hour-at: tail dr-blk plot hour-at 0 append dr-blk [line-width 4] min-at: tail dr-blk plot min-at 0 append dr-blk [line-width 2.5 pen maroon fill-pen maroon circle cen 3 arrow 1x0] sec-at: tail dr-blk plot sec-at 0 view layout [ backeffect [gradient 1x1] box 300x300 effect [draw dr-blk] rate 1 feel [ engage: func [face act evt] [ if act = 'time [ t: now/time plot hour-at to-integer 5 * ((mod t/1 12) + (t/2 / 60)) plot min-at t/2 plot sec-at t/3 show face ] ] ] ]