{"id":20778152,"url":"https://github.com/stackgl/gl-toy","last_synced_at":"2025-08-23T06:35:31.966Z","repository":{"id":24303872,"uuid":"27699395","full_name":"stackgl/gl-toy","owner":"stackgl","description":":crystal_ball: Quickly create WebGL demos using glslify","archived":false,"fork":false,"pushed_at":"2016-01-01T21:50:59.000Z","size":9,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-17T20:59:12.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/stackgl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-12-08T05:28:58.000Z","updated_at":"2022-02-26T17:29:12.000Z","dependencies_parsed_at":"2022-07-24T20:47:14.632Z","dependency_job_id":null,"html_url":"https://github.com/stackgl/gl-toy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/stackgl/gl-toy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-toy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-toy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-toy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-toy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackgl","download_url":"https://codeload.github.com/stackgl/gl-toy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-toy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745679,"owners_count":24813521,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-17T13:19:38.185Z","updated_at":"2025-08-23T06:35:31.916Z","avatar_url":"https://github.com/stackgl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gl-toy\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][downloads-url]\n\nCreate quick GLSL fragment shader demos.\n\n## Installation\n```bash\n$ npm install gl-toy\n```\n\n## Usage\n```js\nvar glslify = require('glslify')\nvar toy     = require('gl-toy')\n\nvar shader = glslify('./shader.frag')\nvar start  = Date.now()\n\ntoy(shader, function(gl, shader) {\n  shader.uniforms.uScreenSize = [gl.drawingBufferWidth, gl.drawingBufferHeight]\n  shader.uniforms.uTime = Date.now() - start\n})\n```\nWith [beefy](http://ghub.io/beefy) installed:\n```js\n$ beefy ./index.js\n```\n\n### toy = glToy(frag, update)\nCreates a new shader renderer, attaching it to `document.body` and making\nit fill the screen.\n\n`frag` should be a fragment shader string you'd like to render using\n[`a-big-triangle`](http://ghub.io/a-big-triangle).\n\n`update(gl, shader)` is called before drawing to the screen so that you\ncan update uniforms being passed into the program. Here, `gl` is a\n`WebGLRenderingContext` and `shader` is an instance of\n[`gl-shader`](http://ghub.io/gl-shader).\n\n### toy.update(frag)\n\nUpdates the current fragment shader with the new `frag`\nstring.\n\n### toy.resize()\n\nResizes the canvas to fit within its parent element, using\n[`canvas-fit`](http://ghub.io/canvas-fit).\n\n### toy.canvas\n\nA reference to `gl-toy`'s canvas element.\n\n### toy.gl\n\nA reference to `gl-toy`'s `WebGLRenderingContext`.\n\n### toy.shader\n\nA reference to `gl-toy`'s instance of\n[`gl-shader`](http://ghub.io/gl-shader).\n\n## Why?\nWebGL and glslify can be a bit tricky to set up. This makes it easier to get\nsomething working quickly. It might not suit all use cases, but then again:\nneither does [shadertoy](https://www.shadertoy.com/).\n\n## Contributors\n- [Yoshua Wuyts](https://github.com/yoshuawuyts)\n- [Hugh Kennedy](https://github.com/hughsk)\n\n## License\n[MIT](https://tldrlegal.com/license/mit-license)\n\n[npm-image]: https://img.shields.io/npm/v/gl-toy.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/gl-toy\n[downloads-image]: http://img.shields.io/npm/dm/gl-toy.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/gl-toy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackgl%2Fgl-toy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackgl%2Fgl-toy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackgl%2Fgl-toy/lists"}