Skip to content

Commit cd0bccb

Browse files
committed
wip
1 parent 860e6c8 commit cd0bccb

File tree

16 files changed

+697
-32
lines changed

16 files changed

+697
-32
lines changed

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ linters:
2626
- gomnd
2727
- ifshort
2828
- interfacer
29+
- interfacebloat
2930
- ireturn
3031
- lll
3132
- maligned

frontend/courses/courses.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
{ "id": "dot", "title": "Red Dot" },
2323
{ "id": "lines", "title": "Lines" },
2424
{ "id": "squares", "title": "Squares" },
25-
{ "id": "rainbow", "title": "Rainbow" }
25+
{ "id": "rainbow", "title": "Rainbow" },
26+
{ "id": "fill", "title": "Stroke and Fill" },
27+
{ "id": "linestyle", "title": "Line Styles" },
28+
{ "id": "text", "title": "Text" },
29+
{ "id": "poly", "title": "Polygon and Polyline" },
30+
{ "id": "ellipse", "title": "Ellipse" },
31+
{ "id": "curve", "title": "Curve" }
2632
]
2733
},
2834
{
@@ -31,6 +37,7 @@
3137
"emoji": "🤹‍♀️",
3238
"units": [
3339
{ "id": "movingdot", "title": "Moving Red Dot" },
40+
{ "id": "bounce", "title": "Bounce" },
3441
{ "id": "juggle", "title": "Juggle" },
3542
{ "id": "splashtrig", "title": "Splash of Trig" },
3643
{ "id": "draw", "title": "Draw" }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
background := "hsl(0deg 0% 0% / 10%)"
2+
x := 10
3+
y := 50
4+
s := 1
5+
width 1
6+
fill background
7+
stroke "red"
8+
9+
on animate
10+
clear background
11+
move x y
12+
circle 10
13+
x = x + s
14+
if x < 10 or x > 90
15+
s = -s
16+
end
17+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print "todo"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
labels := ["x" "y" "radX" "radY" "rot°" "start°" "end°"]
2+
vals := [50 60 30 15 0 0 360]
3+
cnt := len vals
4+
cur := 1
5+
w := 11
6+
7+
draw
8+
9+
on key k:string
10+
update k
11+
draw
12+
end
13+
14+
func update k:string
15+
if k == "ArrowLeft"
16+
cur = (cur + cnt - 1) % cnt
17+
else if k == "ArrowRight"
18+
cur = (cur + 1) % cnt
19+
else if k == "ArrowUp"
20+
vals[cur] = vals[cur] + 1
21+
else if k == "ArrowDown"
22+
vals[cur] = vals[cur] - 1
23+
end
24+
end
25+
26+
func draw
27+
clear "hsl(210deg 5% 15%)" // near black
28+
draw_ellipse
29+
draw_text
30+
draw_highlight cur
31+
end
32+
33+
func draw_ellipse
34+
width 1
35+
fill "red"
36+
stroke "gold"
37+
ellipse vals[0] vals[1] vals[2] vals[3] vals[4] vals[5] vals[6]
38+
end
39+
40+
//TODO: issues!! w := 10
41+
func draw_text
42+
font "italic 300 2rem \"Fira Code\", monospace"
43+
textsize 2.7
44+
width 0.2
45+
fill "hsl(210deg 13% 72%)" // light grey
46+
move 2 2
47+
text "// tab and arrow keys to explore"
48+
move 2 15
49+
text "// "
50+
for i := range (len labels)
51+
move i*w+20 15
52+
text labels[i]
53+
end
54+
font "2rem \"Fira Code\", monospace"
55+
fill "hsl(27deg 100% 74%)" // orange
56+
textsize 3.1
57+
move 2 10
58+
text "ellipse"
59+
fill "hsl(204deg 100% 75%)" // ligth blue
60+
for i := range (len labels)
61+
move i*w+20 10
62+
text (sprintf "%2.0f" vals[i])
63+
end
64+
65+
end
66+
67+
func draw_highlight i:num
68+
fill "none"
69+
stroke "white"
70+
width 0.4
71+
x := i * w + 20
72+
move x-1 9
73+
rect 7 4
74+
end
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
width 2
2+
3+
move 10 65
4+
color "red"
5+
circle 7
6+
move 3 40
7+
rect 14 14
8+
move 3 35
9+
line 17 35
10+
11+
move 30 65
12+
stroke "blue"
13+
circle 7
14+
move 23 40
15+
rect 14 14
16+
move 23 35
17+
line 37 35
18+
19+
move 50 65
20+
color "green"
21+
fill "orange"
22+
circle 7
23+
move 43 40
24+
rect 14 14
25+
move 43 35
26+
line 57 35
27+
28+
move 70 65
29+
stroke "deeppink"
30+
fill "cyan"
31+
circle 7
32+
move 63 40
33+
rect 14 14
34+
move 63 35
35+
line 77 35
36+
37+
move 90 65
38+
stroke "violet"
39+
fill "none"
40+
circle 7
41+
move 83 40
42+
rect 14 14
43+
move 83 35
44+
line 97 35
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
width 3
2+
linecap "round"
3+
move 5 80
4+
line 95 80
5+
6+
linecap "butt"
7+
move 5 70
8+
line 95 70
9+
10+
linecap "square"
11+
move 5 60
12+
line 95 60
13+
14+
width 1
15+
move 5 30
16+
dash 5 3 1 3
17+
line 95 30
18+
19+
dash
20+
move 5 20
21+
line 95 20
22+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
width 1
2+
stroke "red"
3+
fill "gold"
4+
poly [10 20] [50 50] [20 10] [10 20]
5+
6+
fill "none"
7+
poly [10 80] [30 60] [50 80] [70 60] [90 80]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
move 10 80
2+
text "Hello"
3+
4+
move 10 60
5+
textsize 10
6+
text "all 🖖"
7+
8+
move 10 40
9+
fontfamily "Luminari, fantasy"
10+
text "Cheriolas!"
11+
12+
move 10 35
13+
font "italic max(2rem, 2vh) \"Comic Sans MS\", cursive"
14+
text "(Cheering Charm)"

0 commit comments

Comments
 (0)