{"id":13561756,"url":"https://github.com/joakin/elm-canvas","last_synced_at":"2025-04-13T08:39:31.830Z","repository":{"id":41268484,"uuid":"142905471","full_name":"joakin/elm-canvas","owner":"joakin","description":"A canvas drawing library for Elm","archived":false,"fork":false,"pushed_at":"2022-11-21T14:49:58.000Z","size":2137,"stargazers_count":166,"open_issues_count":14,"forks_count":30,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T00:13:18.494Z","etag":null,"topics":["canvas","custom-elements","elm","elm-lang","generative-art","web-components"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/joakin/elm-canvas/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joakin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-30T17:12:58.000Z","updated_at":"2025-03-02T22:15:58.000Z","dependencies_parsed_at":"2023-01-22T03:17:06.435Z","dependency_job_id":null,"html_url":"https://github.com/joakin/elm-canvas","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joakin","download_url":"https://codeload.github.com/joakin/elm-canvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248685205,"owners_count":21145227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canvas","custom-elements","elm","elm-lang","generative-art","web-components"],"created_at":"2024-08-01T13:01:00.767Z","updated_at":"2025-04-13T08:39:31.809Z","avatar_url":"https://github.com/joakin.png","language":"Elm","funding_links":[],"categories":["Elm"],"sub_categories":[],"readme":"# joakin/elm-canvas\n\nThis module exposes a nice drawing API that works on top of the the DOM canvas.\n\n[Live examples](https://joakin.github.io/elm-canvas)\n([example sources](https://github.com/joakin/elm-canvas/tree/master/examples))\n\n![](https://joakin.github.io/elm-canvas/animated-grid.png)\n![](https://joakin.github.io/elm-canvas/dynamic-particles.png)\n![](https://joakin.github.io/elm-canvas/circle-packing.png)\n![](https://joakin.github.io/elm-canvas/trees.png)\n\n## Usage\n\nTo use it, read the docs on the `Canvas` module, and remember to include the\n`elm-canvas` custom element script in your page before you initialize your Elm\napplication.\n\n- [Ellie basic example](https://ellie-app.com/62Dy7vxsBHZa1)\n  - Good starting point to play with the library without installing anything.\n- Basic project template to get started:\n  [joakin/elm-canvas-sketch](https://github.com/joakin/elm-canvas-sketch)\n- \u003chttp://unpkg.com/elm-canvas/elm-canvas.js\u003e\n  - CDN link. Visit it and copy the redirected URL with the version number into\n    your HTML.\n- \u003chttp://npmjs.com/package/elm-canvas\u003e\n  - If you use a bundler like parcel or webpack, you can use the npm package\n- See npm docs for version compatibility, in general, latest npm package/CDN\n  link should work fine with the latest elm package.\n\nThen, you can add your HTML element like this:\n\n```elm\nmodule Main exposing (main)\n\nimport Canvas exposing (..)\nimport Canvas.Settings exposing (..)\nimport Color -- elm install avh4/elm-color\nimport Html exposing (Html)\nimport Html.Attributes exposing (style)\n\nview : Html msg\nview =\n    let\n        width = 500\n        height = 300\n    in\n        Canvas.toHtml (width, height)\n            [ style \"border\" \"1px solid black\" ]\n            [ shapes [ fill Color.white ] [ rect (0, 0) width height ]\n            , renderSquare\n            ]\n\nrenderSquare =\n  shapes [ fill (Color.rgba 0 0 0 1) ]\n      [ rect (0, 0) 100 50 ]\n\nmain = view\n```\n\n## Examples\n\nYou can see many examples in the\n[examples/](https://github.com/joakin/elm-canvas/tree/master/examples) folder,\nand experience them [live](https://joakin.github.io/elm-canvas).\n\nAdditionally, some of the [p5js.org examples](https://p5js.org/examples/) were\nadapted to Elm using this package. They can be found\n[in the Elm discourse thread](https://discourse.elm-lang.org/t/some-p5js-org-examples-in-elm/3781).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoakin%2Felm-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoakin%2Felm-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoakin%2Felm-canvas/lists"}