Changeset 352 for trunk/samples

Show
Ignore:
Timestamp:
12/10/2007 16:17:06 (9 months ago)
Author:
why
Message:
  • samples/cloc.rb: making the stroke thin on the quarter ticks and adding some contrast to the readable time.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/samples/clock.rb

    r337 r352  
    33# posted to the Shoes mailing list on 04 Dec 2007 
    44# 
    5 Shoes.app :height => 250, :width => 250 do 
    6   @radius, @centerx, @centery = 90, 120, 130 
     5Shoes.app :height => 260, :width => 250 do 
     6  @radius, @centerx, @centery = 90, 126, 140 
    77  stack :margin => 10 do 
    88    animate(8) do 
     
    1010      clear do 
    1111        draw_background 
    12         para @time.strftime("%a %b %d, %Y %I:%M:%S"), :align => "center" 
     12        stack do 
     13          background black 
     14          para @time.strftime("%a"), 
     15            span(@time.strftime(" %b %d, %Y "), :stroke => "#ccc"),  
     16            strong(@time.strftime("%I:%M"), :stroke => white),  
     17            @time.strftime(".%S"), :align => "center", :stroke => "#666" 
     18        end 
    1319        clock_hand @time.sec + (@time.usec * 0.000001),2,30,red 
    1420        clock_hand @time.min + (@time.sec / 60.0),5 
     
    1824  end 
    1925  def draw_background 
    20     background rgb(240, 250, 210) 
     26    background rgb(230, 240, 200) 
    2127 
    2228    fill white 
     
    2834 
    2935    stroke black 
    30     line(@centerx, @centery - 100, @centerx, @centery - 95) 
    31     line(@centerx - 100, @centery, @centerx - 95, @centery) 
    32     line(@centerx + 95, @centery, @centerx + 100, @centery) 
    33     line(@centerx, @centery + 95, @centerx, @centery + 100) 
     36    strokewidth 1 
     37    line(@centerx, @centery - 102, @centerx, @centery - 95) 
     38    line(@centerx - 102, @centery, @centerx - 95, @centery) 
     39    line(@centerx + 95, @centery, @centerx + 102, @centery) 
     40    line(@centerx, @centery + 95, @centerx, @centery + 102) 
    3441  end 
    3542  def clock_hand(time, sw, unit=30, color=black)