-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock
More file actions
74 lines (61 loc) · 2.26 KB
/
clock
File metadata and controls
74 lines (61 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import font
def diameter = 157 #CLOCK DIAMETER
def scale = diameter / 100 #scale factor
def fiveSize = 5 * scale #FIVE MINUTE MARKS SIZE
def oneSize = 2.5 * scale #ONE MINUTE MARKS SIZE
def textSize = 5 * scale #SIZE OF THE DIGITS
def innerText = 10 * scale #INWARDS OFFSET OF DIGITS
def textOffsetX = 0 * scale #ADJUSTMENT OF TEXT X
def textOffsetY = 1.5 * scale #ADJUSTMENT OF TEXT Y
### END PARAMETERS ###
### START SCRIPT ###
#calculate which digit to write
def setchar(vx as Number vy as Number id as Number ) = {
if(id < -1) {if(id > -3) {one(vx vy textSize)}}
if(id < 0) {if(id > -2) {two(vx vy textSize)}}
if(id < 1) {if(id > -1) {three(vx vy textSize)}}
if(id < 2) {if(id > 0) {four(vx vy textSize)}}
if(id < 3) {if(id > 1) {five(vx vy textSize)}}
if(id < 4) {if(id > 2) {six(vx vy textSize)}}
if(id < 5) {if(id > 3) {seven(vx vy textSize)}}
if(id < 6) {if(id > 4) {eight(vx vy textSize)}}
if(id < 7) {if(id > 5) {nine(vx vy textSize)}}
if(id < 8) {if(id > 6) {one(vx - (textSize / 2) vy textSize)
zero(vx + (textSize / 2) vy textSize)}}
if(id < 9) {if(id > 7) {one(vx - (textSize / 2) vy textSize)
one(vx + (textSize / 2) vy textSize)}}
if(id < 10) {if(id > 8) {one(vx - (textSize / 2) vy textSize)
two(vx + (textSize / 2) vy textSize)}}
}
def outer = (diameter / 2) - 1
def innerFive = (diameter / 2) - fiveSize
def innerOne = (diameter / 2) - oneSize
#FIVE MINUTE MARKS
repeat -2 to 10 using inc {
def vx = -1 * cos(radians(inc * 30))
def vy = sin(radians(inc * 30))
line(vx * innerFive vy * innerFive vx * outer vy * outer)
#TEXT
def textX = (-1 - vx * (diameter / 2) - innerText) - textOffsetX
def textY = (-1 - vy * (diameter / 2) - innerText) - textOffsetY
setchar(textX textY inc)
}
#ONE MINUTE MARKS
repeat 0 to 60 using inc {
def vx = cos(radians(inc * 6))
def vy = sin(radians(inc * 6))
line(vx * innerOne vy * innerOne vx * outer vy * outer)
}
#OUTER AND CENTER CIRCLE
circle(0 0 diameter / 2)
circle(0 0 1)
def s = diameter / 100
R(-16 * scale 5 * scale 5 * scale)
E(-12 * scale 5 * scale 5 * scale)
P(-8 * scale 5 * scale 5 * scale)
O(-4 * scale 5 * scale 5 * scale)
C(0 * scale 5 * scale 5 * scale)
L(4 * scale 5 * scale 5 * scale)
O(8 * scale 5 * scale 5 * scale)
C(12 * scale 5 * scale 5 * scale)
K(16 * scale 5 * scale 5 * scale)