-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into flowfield-example
- Loading branch information
Showing
35 changed files
with
234 additions
and
218 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
open Joy | ||
|
||
let () = | ||
init (); | ||
let c = circle 100. in | ||
let hole = scale 0.5 c in | ||
show [ c; hole ]; | ||
write ~filename:"donut_with_scale.png" () |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
open Joy | ||
|
||
let size = 800. | ||
let interval = 16. | ||
let line_interval = 800. /. interval | ||
let rec range a b = if a > b then [] else a :: range (a +. 1.) b | ||
let inc x = x +. 1. | ||
let size = 800 | ||
let interval = 16 | ||
let line_interval = 800 / interval | ||
let rec range a b = if a > b then [] else a :: range (a + 1) b | ||
let inc x = x + 1 | ||
|
||
let _ = | ||
init ~size:(size, size) (); | ||
let half_size = size /. 2. in | ||
background (1., 1., 1., 1.); | ||
let half_size = size / 2 in | ||
background (255, 255, 255, 255); | ||
let lines = | ||
List.map | ||
(fun i -> | ||
let newx = i |> inc |> ( *. ) line_interval in | ||
let newx = i |> inc |> ( * ) line_interval in | ||
line | ||
~a:(point (newx -. half_size) (-.half_size)) | ||
(point (newx -. half_size) half_size)) | ||
(range 0. interval) | ||
~a:(point (newx - half_size) (-half_size)) | ||
(point (newx - half_size) half_size)) | ||
(range 0 interval) | ||
in | ||
set_color (0., 0., 0.); | ||
set_color (0, 0, 0); | ||
show lines; | ||
write ~filename:"line.png" () |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
open Joy | ||
|
||
let size = 100. | ||
let size = 100 | ||
|
||
let () = | ||
init (); | ||
background (1., 1., 1., 1.); | ||
background (255, 255, 255, 255); | ||
(* creating a rectangle from points *) | ||
let rect = rectangle size size in | ||
set_color (0., 0., 0.); | ||
set_color (0, 0, 0); | ||
render rect; | ||
write ~filename:"rectangle.png" () |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
open Joy | ||
|
||
let () = | ||
init ~size:(500., 300.) (); | ||
background (1., 1., 1., 1.); | ||
let c = circle 50. in | ||
set_color (0., 0., 0.); | ||
show [ c ]; | ||
write ~filename:"rectangular_canvas.png" () |
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
Oops, something went wrong.