{"id":20778025,"url":"https://github.com/stackgl/gl-particles","last_synced_at":"2025-08-22T00:43:04.510Z","repository":{"id":29735738,"uuid":"33279100","full_name":"stackgl/gl-particles","owner":"stackgl","description":":sparkles: Convenience module for FBO-driven particle simulations.","archived":false,"fork":false,"pushed_at":"2015-04-16T00:50:47.000Z","size":208,"stargazers_count":59,"open_issues_count":0,"forks_count":6,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-07-08T10:55:58.557Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://stack.gl/gl-particles/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-01T23:50:34.000Z","updated_at":"2025-05-01T15:20:43.000Z","dependencies_parsed_at":"2022-09-06T18:10:48.512Z","dependency_job_id":null,"html_url":"https://github.com/stackgl/gl-particles","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stackgl/gl-particles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-particles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-particles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-particles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-particles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackgl","download_url":"https://codeload.github.com/stackgl/gl-particles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-particles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267604362,"owners_count":24114526,"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-07-28T02:00:09.689Z","response_time":68,"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:18:42.019Z","updated_at":"2025-07-28T23:34:42.402Z","avatar_url":"https://github.com/stackgl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gl-particles\n\n[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)\n\nConvenience module for FBO-driven particle simulations.\n\n**[view demo](http://stack.gl/gl-particles/)**\n\n## Usage\n\n[![NPM](https://nodei.co/npm/gl-particles.png)](https://nodei.co/npm/gl-particles/)\n\nSee [demo.js](demo.js) for a full example.\n\n### `particles = Particles(gl, options)`\n\nCreates a new particle simulation given a WebGLContext `gl` and set\nof `options`:\n\n* `logic`: the logic shader for simulating the particles, as a string. Required.\n* `vert`: the vertex shader responsible for determining the rendered particles'\n  position and size. Required.\n* `frag`: the fragment shader responsible for determining the color/texture of\n  each particle. Required.\n* `shape`: a `[width, height]` array for the dimensions of the particle texture.\n  This determines the total amount of particles, which should be `width * height`.\n  Defaults to `[64, 64]`.\n\nYour logic shader will automatically be assigned the following uniforms:\n\n* `sampler2D data`: the particle data texture.\n* `vec2 resolution`: the width/height of the data texture.\n\nAnd your fragment/vertex shaders will be assigned the following:\n\n* `sampler2D data`: the particle data texture.\n\n### `particles.populate((u, v, vec4) =\u003e)`\n\nPopulates the data for each particle in your FBO textures individually.\n\n* `u` is the horizontal index of the particle in pixels.\n* `v` is the vertical index of the particle in pixels.\n* `vec4` is a 4-element array which you should modify in-place to update\n  the current particle's values.\n\nFor example, if you have 2D positions for your particles you would set them\nrandomly like so:\n\n``` javascript\nparticles.populate(function(u, v, vec4) {\n  vec4[0] = Math.random() * 2 - 1\n  vec4[1] = Math.random() * 2 - 1\n})\n```\n\n### `particles.step((uniforms) =\u003e)`\n\nRuns one step of the `logic` shader – should generally be done once per\nframe.\n\nYou may optionally pass in a function to update the shader's uniforms, e.g.:\n\n``` javascript\nvar start = Date.now()\n\nparticles.step(function(uniforms) {\n  uniforms.time = (Date.now() - start) / 1000\n})\n```\n\n*Note that this will modify your WebGL state. Specifically, it will reset\nyour current framebuffer, viewport and shader.*\n\n### `particles.draw((uniforms) =\u003e)`\n\nDraws your particles to the screen using the `vert` and `frag` shaders.\n\nAs with `particles.step`, you may pass in an optional function for updating\nthe shader's uniforms.\n\n### `particles.setLogicShader(logicShaderSource)`\n\nChange the logic shader to `logicShaderSource`.\n\n## Contributing\n\nSee [stackgl/contributing](https://github.com/stackgl/contributing) for details.\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/stackgl/gl-particles/blob/master/LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackgl%2Fgl-particles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackgl%2Fgl-particles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackgl%2Fgl-particles/lists"}