DEV Community

Cover image for Glimmer Clock
Andy Maleh
Andy Maleh

Posted on

1 1

Glimmer Clock

Glimmer DSL for SWT 4.20.15.1 (JRuby Desktop Development GUI Framework) shipped with a Glimmer Clock elaborate sample.

Glimmer Clock

Code:

# From: https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_SAMPLES.md#clock

class Clock
  include Glimmer::UI::CustomShell

  body {
    shell {
      text 'Glimmer Clock'
      minimum_size 400, 430

      canvas {
        initial_time = Time.now
        background :black

        animation {
          every 0.01 # every hundredth of a second to ensure higher accuracy

          frame { |index|
            time = Time.now

            oval(0, 0, 400, 400) {
              background :white
            }
            polygon(-5, -5, 180, 0, -5, 5) {
              background :black

              transform {
                translate 200, 200
                rotate(time.sec*6 - 90)
              }
            }
            polygon(-5, -5, 135, 0, -5, 5) {
              background :dark_gray

              transform {
                translate 200, 200
                rotate(time.min*6 - 90)
              }
            }
            polygon(-5, -5, 90, 0, -5, 5) {
              background :gray

              transform {
                translate 200, 200
                rotate((time.hour - 12)*30 - 90)
              }
            }
          }
        }
      }
    }
  }
end

Clock.launch
Enter fullscreen mode Exit fullscreen mode

Happy Glimmering!

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more