Skip to content

Commit

Permalink
Run dune fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Mar 12, 2024
1 parent e7adc6c commit c017330
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
41 changes: 20 additions & 21 deletions examples/smile.ml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
open Joy

let make_nose () =
let l = line (point 0 50)|> translate 0 (-25) in
let l1 = l in
let l2 = l |> rotate 90|> translate 0 (-25) in
let nose = complex [l1; l2] in
nose
let l = line (point 0 50) |> translate 0 (-25) in
let l1 = l in
let l2 = l |> rotate 90 |> translate 0 (-25) in
let nose = complex [ l1; l2 ] in
nose

let make_arc rx ry =
let r = rectangle ~c:(point 0 (ry / 2)) (2 * rx) ry in
let col = r |> with_fill white |> with_stroke white in
let e = ellipse ~c:(point 0 0) rx ry in
complex [e; col]
let make_arc rx ry =
let r = rectangle ~c:(point 0 (ry / 2)) (2 * rx) ry in
let col = r |> with_fill white |> with_stroke white in
let e = ellipse ~c:(point 0 0) rx ry in
complex [ e; col ]

let () =
init ();
let a = circle 200 in
let d = circle ~c:(point 50 50) 20 in
let b = circle ~c:(point (-50) 50) 20 in
let nose = make_nose () in
let leb = make_arc 26 14 |> rotate 180 |> translate 50 70 in
let reb = make_arc 26 14 |> rotate 180 |> translate (-50) 70 in
let mouth = make_arc 80 40 |>translate 0 (-60) in
show [mouth;leb;reb;a;d;b;nose];
write ()

init ();
let a = circle 200 in
let d = circle ~c:(point 50 50) 20 in
let b = circle ~c:(point (-50) 50) 20 in
let nose = make_nose () in
let leb = make_arc 26 14 |> rotate 180 |> translate 50 70 in
let reb = make_arc 26 14 |> rotate 180 |> translate (-50) 70 in
let mouth = make_arc 80 40 |> translate 0 (-60) in
show [ mouth; leb; reb; a; d; b; nose ];
write ()
3 changes: 2 additions & 1 deletion lib/shape.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ let rectangle ?(c = origin) width height =

let ellipse ?(c = origin) rx ry =
let rx, ry = (float_of_int rx, float_of_int ry) in
Ellipse { c; rx; ry; stroke = Color.black; fill = Color.transparent; rotation = 0. }
Ellipse
{ c; rx; ry; stroke = Color.black; fill = Color.transparent; rotation = 0. }

let line ?(a = origin) b = Line { a; b; stroke = Color.black }

Expand Down

0 comments on commit c017330

Please sign in to comment.