{"id":20322101,"url":"https://github.com/alterebro/p5.fillgradient","last_synced_at":"2025-04-11T19:11:32.935Z","repository":{"id":63980026,"uuid":"472915910","full_name":"alterebro/p5.fillGradient","owner":"alterebro","description":"Fill shapes in p5.js with Linear, Radial and Conic Gradients.","archived":false,"fork":false,"pushed_at":"2024-10-31T18:54:58.000Z","size":355,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T19:54:26.958Z","etag":null,"topics":["addon","conic","fill","gradient","linear","p5","p5-js","p5js","processing","radial"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/p5.fillgradient","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alterebro.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-22T19:50:45.000Z","updated_at":"2025-04-06T17:10:52.000Z","dependencies_parsed_at":"2024-10-31T19:23:56.356Z","dependency_job_id":"fa2917a0-84d3-4684-b214-773147eadeca","html_url":"https://github.com/alterebro/p5.fillGradient","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"a2035b7f9adcc5b4bf6d8c1a79bf5d1c2c17ebae"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterebro%2Fp5.fillGradient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterebro%2Fp5.fillGradient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterebro%2Fp5.fillGradient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterebro%2Fp5.fillGradient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alterebro","download_url":"https://codeload.github.com/alterebro/p5.fillGradient/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248465344,"owners_count":21108244,"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":["addon","conic","fill","gradient","linear","p5","p5-js","p5js","processing","radial"],"created_at":"2024-11-14T19:19:02.157Z","updated_at":"2025-04-11T19:11:32.901Z","avatar_url":"https://github.com/alterebro.png","language":"JavaScript","readme":"\u003cimg style=\"display: block; width: 100%;\" src=\"p5fillgradient.jpg\" /\u003e\n\n\n# p5.fillGradient\n\n\u003e Fill shapes in [p5.js](http://p5js.org/) with **Linear, Radial and Conic Gradients**.\n**p5.fillGradient** enables shape filling with Linear, Radial and Conic Gradients instead of plain colours in your [p5.js](http://p5js.org/) sketch.\n\n## Install\n\nDownload the script and add it to your web document along with the p5.js library.\n\n```html\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.1/p5.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"./path/to/p5.fillGradient.min.js\"\u003e\u003c/script\u003e\n```\n\nThey are both available on NPM:\n\n```html\n\u003cscript src=\"https://unpkg.com/p5\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/p5.fillgradient\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n**p5.fillGradient** exposes the `fillGradient()` function into your p5js sketch and sets the current fill style with the parameters defined by the user once it is called.\n\n### `fillGradient(type, properties, context)`\n\n#### \u0026mdash; `type`\n\n`String` with one of these values: *linear*, *radial* or *conic*. It defaults to *linear*. Be aware that browser support for *conic* gradients is still poor and not fully adopted by all major browsers. More info \u0026rarr; [Can I use? CanvasRenderingContext2D API: createConicGradient](https://caniuse.com/mdn-api_canvasrenderingcontext2d_createconicgradient)\n\n```js\n// i.e:\nfillGradient('linear',...\n```\n\n#### \u0026mdash; `properties`\n\n`Object` (Optional) with the following keys:\n\n* **`from`** : *`Array [x, y, (radius | angle)]`*. Starting x and y point absolute coordinates. Radial and Conic gradients add a third value, `radius` / `angle` (expressed in degrees) respectively.\n* **`to`** : *`Array [x, y, (radius)]`*. Ending x and y point coordinates.\n* **`steps`** : *`Array`*. Each array item is either an *`Array [p5Color Object, stopAt]`* or a *`p5Color Object`* that will distribute stopping steps equally\n\n```js\n// i.e:\n('linear', {\n    'from' : [20, 20], // starting point [x, y] coords\n    'to' : [580, 580], // ending point [x, y] coords\n    'steps' : [\n        [ color(255), 0 ], // p5Color Object, stopAt (0-1)\n        [ color(0, 96, 164), .25 ],\n        [ color(0, 128, 196), .75 ],\n        [ color(0), 1 ]\n    ]\n})\n```\n\n#### \u0026mdash; `context`\n\n`Object (drawingContext)` (Optional)\n\n\n## Examples:\n\n### Linear Gradient\n\n```js\nfillGradient('linear', {\n    from : [0, 0],   // x, y : Coordinates\n    to : [400, 400], // x, y : Coordinates\n    steps : [\n        color(255),\n        color(0, 96, 164),\n        color(0)\n    ] // Array of p5.color objects or arrays containing [p5.color Object, Color Stop (0 to 1)]\n});\n```\n\n### Radial Gradient\n\n```js\nfillGradient('radial', {\n    from : [200, 200, 0], // x, y, radius\n    to : [200, 200, 200], // x, y, radius\n    steps : [\n        color(255),\n        color(0, 96, 164),\n        color(0)\n    ] // Array of p5.color objects or arrays containing [p5.color Object, Color Stop (0 to 1)]\n});\n```\n\n### Conic Gradient\n\n```js\nfillGradient('conic', {\n    from : [200, 200, 0], // x, y, angle(degrees)\n    steps : [\n        color(255),\n        color(0, 96, 164),\n        color(0)\n    ] // Array of p5.color objects or arrays containing [p5.color Object, Color Stop (0 to 1)]\n});\n```\n\n\n---\n\n\u0026mdash; [@alterebro](https://twitter.com/alterebro)\n\n\n\u003c!--\n```json\n{\n    \"name\" : \"p5.fillGradient\",\n    \"desc\" : {\n        \"en\" : \"p5.fillGradient allows you to fill shapes with Linear, Radial and Conic Gradients instead of plain colours\",\n        \"es\" : \"p5.fillGradient permite rellenar formas con degradados lineales, radiales y cónicos en vez de con colores planos\"\n    },\n    \"url\" : \"https://github.com/alterebro/p5.fillGradient\",\n    \"author\" : {\n        \"name\" : \"Jorge Moreno\",\n        \"url\" : \"https://alterebro.com\",\n        \"twitter\" : \"@alterebro\",\n        \"instagram\" : \"alterebro\"\n    },\n    \"misc\" : [\n        \"p5.fillGradient enables p5.js to fill shapes with Linear, Radial and Conic Gradients\",\n        \"Fill shapes in p5.js with Linear, Radial and Conic Gradients\"\n    ]\n}\n```\n--\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falterebro%2Fp5.fillgradient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falterebro%2Fp5.fillgradient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falterebro%2Fp5.fillgradient/lists"}