Created
August 20, 2018 05:51
-
-
Save toomasv/a938506a694ffd14346239198e20b428 to your computer and use it in GitHub Desktop.
Just an exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "Desktop clock" | |
Author: "Toomas Vooglaid" | |
Date: 2018-08-20 | |
Needs: View | |
] | |
context [ | |
i: hour: min: sec: digital: ang: none | |
fc: make face! [type: 'text] | |
fnt: make font! [color: gray size: 12] | |
view/flags/options compose/deep [ | |
box snow 201x201 draw [ | |
fill-pen linen pen gray | |
circle 100x100 100 | |
( | |
collect [ | |
repeat i 60 [keep (compose/deep [ | |
rotate (i * 6) 100x100 [ | |
line 100x0 (as-pair 100 either i % 5 = 0 [7][3]) | |
] | |
])] | |
] | |
) | |
( | |
collect [ | |
repeat i 12 [keep compose [ | |
text ( | |
subtract 100x100 + | |
as-pair | |
83 * cosine ang: i * 30 - 90 | |
83 * sine ang | |
(fc/text: form i size-text fc) / 2.0 + 1x1 | |
) | |
(form i) | |
]] | |
] | |
) | |
pen water line-width 5 | |
hour: rotate 0 100x100 [line 100x100 100x30] | |
line-width 3 | |
min: rotate 0 100x100 [line 100x100 100x15] | |
line-width 2 pen papaya | |
sec: rotate 0 100x100 [line 100x100 100x10] | |
font fnt | |
digital: text 75x120 "" | |
] rate 1 now on-time [ | |
time: now/time | |
hour/2: add 30 * time/hour time/minute / 2.0 | |
min/2: add 6 * time/minute time/second / 10.0 | |
sec/2: 6 * time/second | |
digital/3: form time | |
] | |
][no-border][ | |
offset: as-pair system/view/screens/1/size/x - 220 0 | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment