{"id":16333835,"url":"https://github.com/nmattia/quad-shader","last_synced_at":"2025-06-12T20:04:42.977Z","repository":{"id":253692949,"uuid":"840209224","full_name":"nmattia/quad-shader","owner":"nmattia","description":"Zero-deps library for creating WebGL-based applications using Vite and TypeScript","archived":false,"fork":false,"pushed_at":"2025-05-05T19:15:48.000Z","size":145,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T18:13:27.981Z","etag":null,"topics":["creativecoding","typescript","vite","web","webgl"],"latest_commit_sha":null,"homepage":"https://nmattia.github.io/quad-shader/","language":"TypeScript","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/nmattia.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,"zenodo":null}},"created_at":"2024-08-09T07:47:04.000Z","updated_at":"2025-06-05T17:51:20.000Z","dependencies_parsed_at":"2025-01-01T21:34:24.475Z","dependency_job_id":"714f370e-2c55-4577-a972-58f50e855dc1","html_url":"https://github.com/nmattia/quad-shader","commit_stats":null,"previous_names":["nmattia/webgl-shader-template"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nmattia/quad-shader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmattia%2Fquad-shader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmattia%2Fquad-shader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmattia%2Fquad-shader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmattia%2Fquad-shader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmattia","download_url":"https://codeload.github.com/nmattia/quad-shader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmattia%2Fquad-shader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259521513,"owners_count":22870446,"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":["creativecoding","typescript","vite","web","webgl"],"created_at":"2024-10-10T23:36:42.803Z","updated_at":"2025-06-12T20:04:42.973Z","avatar_url":"https://github.com/nmattia.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg width=300 height=300 src=\"https://github.com/user-attachments/assets/52f41567-effd-49a3-90b1-544e19d3e3bc\" /\u003e\n\u003c/p\u003e\n\n# Quad Shader\n\nThis is a JavaScript library to build shader-based, 2D animations. You provide\na GLSL shader to the `animate()` function which renders it to a quad.\n\nWhether you're just getting started with WebGL or looking for a quick way to\nbootstrap your shader projects, this library should serve as a solid\nfoundation.\n\nFor a longer introduction, see the [official webpage](https://nmattia.github.io/quad-shader/).\n\n## Getting started\n\nFirst create a new project. The recommended way is to use [Vite](https://vitejs.dev/)\n\n```bash\nnpm create vite@latest my-quad-shader-app\n```\n\nThen install the `quad-shader` library:\n\n```bash\nnpm install quad-shader\n```\n\nThen add an `\u003ccanvas\u003e` element to the `index.html` generated by Vite. Edit the CSS to set a fixed size for the canvas:\n\n```css\ncanvas {\n    width: 100%;\n}\n```\n\nFinally add a `\u003cscript type=\"module\"\u003e...\u003c/script\u003e` element with the following content:\n\n```ts\nimport { animate, getComputedStylePropRGBA } from \"quad-shader\";\nconst qs = animate(document.querySelector(\"canvas\"), `\n  precision lowp float;\n  varying vec2 vPosition;\n  uniform vec4 uColor;\n  uniform float uTime;\n  void main() {\n      float theta = atan(vPosition.y, vPosition.x);\n      float rho = length(vPosition.xy);\n      float v = mod(rho - uTime/10., .2);\n      float alpha *= smoothstep(.1, .2, v);\n      alpha *= (1. - smoothstep(0., 1., rho));\n      gl_FragColor = alpha * uColor;\n  }\n`);\nqs.uniform4f(\"uColor\", () =\u003e getComputedStylePropRGBA(qs.canvas, \"color\"));\n```\n\nTo start the development server with hot-reloading:\n\n```bash\nnpm run dev\n```\n\nYour project should now be running at [http://localhost:5173](http://localhost:5173).\nOpen the URL in your browser to see the template in action. Any changes you\nmake to the shaders or TypeScript files will automatically reload the page.\n\nThe `\u003ccanvas\u003e` is now rendering an animation. For more information, see\n[https://nmattia.github.io/quad-shader/](https://nmattia.github.io/quad-shader/).\n\n### License\n\nThis project is licensed under the [MIT License](LICENSE). You are free to use,\nmodify, and distribute this template in your own projects.\n\nIf you have any questions or need further assistance, feel free to reach out\nvia the issues tab on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmattia%2Fquad-shader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmattia%2Fquad-shader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmattia%2Fquad-shader/lists"}