{"id":16579510,"url":"https://github.com/mkkellogg/photons","last_synced_at":"2025-03-21T12:32:29.616Z","repository":{"id":83456671,"uuid":"43770481","full_name":"mkkellogg/Photons","owner":"mkkellogg","description":"Particle system for Three.js","archived":false,"fork":false,"pushed_at":"2023-09-08T16:48:48.000Z","size":14158,"stargazers_count":28,"open_issues_count":3,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-18T01:37:36.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkkellogg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2015-10-06T18:32:34.000Z","updated_at":"2023-05-26T08:33:03.000Z","dependencies_parsed_at":"2024-10-31T23:32:33.693Z","dependency_job_id":null,"html_url":"https://github.com/mkkellogg/Photons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkkellogg%2FPhotons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkkellogg%2FPhotons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkkellogg%2FPhotons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkkellogg%2FPhotons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkkellogg","download_url":"https://codeload.github.com/mkkellogg/Photons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244799518,"owners_count":20512264,"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":[],"created_at":"2024-10-11T22:18:15.021Z","updated_at":"2025-03-21T12:32:29.606Z","avatar_url":"https://github.com/mkkellogg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Photons - JavaScript Particle System\n\n\u003cbr /\u003e\n\u003ch3\u003e!! Deprecated !!\u003c/h3\u003e\nThis library is now deprecated in order to focus on my new particle system, Photons 2 (https://github.com/mkkellogg/Photons2)\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\nBasic particle system for the Three.js 3D graphics library implemented in JavaScript. Three.js does not currently have an official particle system implementation, so this is meant to be a general purpose extendable particle system for it.\n\nThis implementation exposes typical physical attributes for each particle: \n\n  - Position\n  - Velocity\n  - Acceleration\n  - Rotation\n  - Rotational speed\n  - Rotational acceleration\n        \nThis implementation also exposes display attributes:\n\n  - Color\n  - Size\n  - Opacity \n  - Texture\n\nA \"Modifier\" can be assigned to each of the attributes mentioned above to vary the value for it over the lifetime of the particle.\n\nThe current implementation also supports the concept of a texture atlas (spritesheet) so particle textures can be animated.\n\nThe current version produces 3D geometry for each particle by creating a quad for each and orienting the quad so that its normal is parallel to the camera's normal (but pointing in the opposite direction).\n\nThe repository includes a demo page (index.html) that demonstrates how to define and initialize particle systems.\n\n# Sample code\n\nThis example sets up a fire simulation particle system using an atlas:\n\n```javascript\nvar _TPSV = PHOTONS.SingularVector;\n\n// create a material for the particle system\nvar flameMaterial = PHOTONS.ParticleSystem.createMaterial();\nflameMaterial.blending = THREE.AdditiveBlending;\n\n// define the particle system's parameters\nvar particleSystemParams = {\n\n\tmaterial: flameMaterial,\n\tparticleAtlas : PHOTONS.Atlas.createGridAtlas( THREE.ImageUtils.loadTexture( 'textures/campfire/fireloop3.jpg' ), 0.0, 1.0, 1.0, 0.0, 8.0, 8.0, false, true ),\n\tparticleReleaseRate : 3,\n\tparticleLifeSpan : 3,\n\tlifespan : 0\n\n};\n\n// create and initialize the particle system\nvar particleSystem = new PHOTONS.ParticleSystem();\nparticleSystem.initialize( camera, particleSystemParams );\n\n// set up a modifier that interpolates atlas indices\nparticleSystem.bindModifier( \"atlas\", new PHOTONS.EvenIntervalIndexModifier ( 64 ) );\n\n// set up a modifier that interpolates particle size over a set of key frames\nparticleSystem.bindModifier( \"size\", new PHOTONS.FrameSetModifier(\n\tnew PHOTONS.FrameSet(\n\t\t[ 0, 3 ],\n\t\t[ new THREE.Vector3( 20, 25 ),\n\t\tnew THREE.Vector3( 20, 25 ) ],\n\t\tfalse )\n) );\n\n// set up a modifier that interpolates particle opacity over a set of key frames\nparticleSystem.bindModifier( \"alpha\", new PHOTONS.FrameSetModifier(\n\tnew PHOTONS.FrameSet(\n\t\t[ 0, 0.2, 1.2, 2.0, 3 ],\n\t\t[ new _TPSV( 0 ), new _TPSV( 0.3 ), new _TPSV( 1 ), new _TPSV( 1 ), new _TPSV( 0 ) ],\n\t\ttrue )\n) );\n\n// set up a modifier that interpolates particle color over a set of key frames\nparticleSystem.bindModifier( \"color\", new PHOTONS.FrameSetModifier(\n\tnew PHOTONS.FrameSet(\n\t\t[ 0, 3 ],\n\t\t[ new THREE.Vector3( 1.4, 1.4, 1.4 ),\n\t\tnew THREE.Vector3( 1.4, 1.4, 1.4 ) ],\n\t\tfalse )\n) );\n\n// set up a modifier that runs once when the particle is initialized to randomize the initial position\nparticleSystem.bindInitializer( 'position', new PHOTONS.RandomModifier(\n\t{\n\t\toffset: new THREE.Vector3( 0, 0, 0 ),\n\t\trange: new THREE.Vector3( 0, 0, 0 ),\n\t\trangeEdgeClamp: false,\n\t\trangeType: PHOTONS.RangeType.Sphere\n\t} ) );\n\n// set up a modifier that runs once when the particle is initialized to randomize the initial velocity\nparticleSystem.bindInitializer( 'velocity', new PHOTONS.RandomModifier(\n\t{\n\t\toffset: new THREE.Vector3( 0, 25, 0 ),\n\t\trange: new THREE.Vector3( 10, 2, 10 ),\n\t\trangeEdgeClamp: false,\n\t\trangeType: PHOTONS.RangeType.Sphere\n\t} ) );\n\n// start the particle system\nparticleSystem.activate();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkkellogg%2Fphotons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkkellogg%2Fphotons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkkellogg%2Fphotons/lists"}