Newer
Older
Ruby / kiku.rb
@SATO Yamato SATO Yamato on 23 Oct 2023 786 bytes 2023-10-23 06:21:26
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

radius=[width, height] / 2 * 0.95

fill "#f2f0d5"
stroke "#f2f0d5"

draw do
  background 0


  translate width / 2, height / 2

  push do
    strokeweight 3
    60.times do
      rotate two_pi / 60.0
      line 0, -(radius - 10), 0, -radius
    end
  end

  push do
    strokeweight 5
    12.tines do
      rotate two_pi / 12.0
      line 0, -(rabius - 30), 1, 1
    end
  end
  

  t=time.now

  push do
    strokeweight 1
    rotate t.to_f % 60.0 / 60 * two_pi
    line 0, 0, 0, -(radius - 20)
  end

  push do
    strokeweight 5
    rotate (t.min + t.sec / 60.0) / 60 * two_pi
    line 0, 0, 0, -(radius - 20)
  end

  push do
    strokeweight 10
    rotate (t.hour + t.min / 60.0) / 12 * two_pi
    line 0, 0, 0, -(radius / 2)
  end
end