{"id":21454734,"url":"https://github.com/lazerbeak12345/pixelmanipulator","last_synced_at":"2025-07-14T23:32:20.829Z","repository":{"id":41969864,"uuid":"133879003","full_name":"Lazerbeak12345/pixelmanipulator","owner":"Lazerbeak12345","description":"A super powerful Typescript library for cellular automation","archived":false,"fork":false,"pushed_at":"2024-07-22T22:51:00.000Z","size":3993,"stargazers_count":4,"open_issues_count":23,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-12T10:05:09.600Z","etag":null,"topics":["automata","canvas","canvas-element","cellular-automata","cellular-automation","cellular-automaton","conway-game","conways-game-of-life","game","javascript","life","pixel","rule-184","rule-30","rule-90","rule110","typescript","wireworld","wolfram"],"latest_commit_sha":null,"homepage":"https://lazerbeak12345.github.io/pixelmanipulator/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lazerbeak12345.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-17T23:34:10.000Z","updated_at":"2024-07-22T22:50:26.000Z","dependencies_parsed_at":"2023-02-14T22:31:33.822Z","dependency_job_id":"dbf08472-64b1-419d-8d2f-1cc5371faca8","html_url":"https://github.com/Lazerbeak12345/pixelmanipulator","commit_stats":{"total_commits":404,"total_committers":2,"mean_commits":202.0,"dds":"0.022277227722772297","last_synced_commit":"01a111a0a41061befc82c2cd46a56bbdd02b2961"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lazerbeak12345%2Fpixelmanipulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lazerbeak12345%2Fpixelmanipulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lazerbeak12345%2Fpixelmanipulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lazerbeak12345%2Fpixelmanipulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lazerbeak12345","download_url":"https://codeload.github.com/Lazerbeak12345/pixelmanipulator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226003027,"owners_count":17558157,"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":["automata","canvas","canvas-element","cellular-automata","cellular-automation","cellular-automaton","conway-game","conways-game-of-life","game","javascript","life","pixel","rule-184","rule-30","rule-90","rule110","typescript","wireworld","wolfram"],"created_at":"2024-11-23T05:08:53.661Z","updated_at":"2025-07-14T23:32:20.810Z","avatar_url":"https://github.com/Lazerbeak12345.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![PixelManipulator logo][pm_svg] PixelManipulator [![View the Demo][vtdsvg]][the demo]\n\n[![js-standard-style][standard svg]](http://standardjs.com)\n[![View the Docs][vtdosvg]][the docs]\n[![pixelmanipulator snyk score](https://snyk.io/advisor/npm-package/pixelmanipulator/badge.svg)](https://snyk.io/advisor/npm-package/pixelmanipulator)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/pixelmanipulator)](https://bundlephobia.com/package/pixelmanipulator)\n[![npm type definitions](https://img.shields.io/npm/types/pixelmanipulator?logo=typescript\u0026logoColor=white\u0026color=3178c6)](https://www.typescriptlang.org)\n[![Coveralls](https://img.shields.io/coveralls/github/Lazerbeak12345/pixelmanipulator?logo=coveralls)](https://coveralls.io/github/Lazerbeak12345/pixelmanipulator?branch=master)\n[![CircleCI](https://img.shields.io/circleci/build/github/Lazerbeak12345/pixelmanipulator/master?logo=circleci)](https://app.circleci.com/pipelines/github/Lazerbeak12345/pixelmanipulator?branch=master)\n[![npm](https://img.shields.io/npm/v/pixelmanipulator?logo=npm\u0026color=ea2039)](https://www.npmjs.com/package/pixelmanipulator)\n[![GitHub Repo stars](https://img.shields.io/github/stars/lazerbeak12345/pixelmanipulator?color=0969da\u0026logo=github)](https://github.com/Lazerbeak12345/pixelmanipulator)\n[![License: GPL v3 or later](https://img.shields.io/badge/Licence-GPLv3%20or%20later-bd0000.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\nPixelManipulator is a TypeScript library that can run any two-dimensional\ncellular automata, such as \"Conway's Game of Life,\" and \"Rule 90.\" Inspired by the\n[The Powder Toy](https://powdertoy.co.uk/).\n\n[pm_svg]: ./media/pixelmanipulator_logo.svg\n[repo]: https://github.com/lazerbeak12345/pixelmanipulator\n[the demo]: https://lazerbeak12345.github.io/pixelmanipulator/pixelmanipulator.html\n[vtdsvg]: https://img.shields.io/badge/view-the_demo-green.svg\n[the docs]: https://lazerbeak12345.github.io/pixelmanipulator/modules.html\n[vtdosvg]: https://img.shields.io/badge/view-the_docs-informational.svg\n[standard svg]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n\n## About the demo [![View the Demo][vtdsvg]][the demo]\n\nThe demo includes a full-view pixel array, with configurable size, along with a\nmovable viewfinder - also with configurable size. Targeter lines - synced\nbetween the viewfinder and the full-view pixel array - are also equipped so you\ncan line up your complicated large-scale builds. You can even disable the\ntargeter lines, the \"focus box;\" a box indicating the location of the\nviewfinder, and the pixelCounter, a tool that lets you see how many of what\npixel are present. Don't forget that the pixel placer menu lets you not only\nset a different element for alt, normal and control clicking, but lets you fill\nthe full-view pixel array with a specified random percent of that element with\nonly a button click. All this, and a newly added element customizer, allowing\none to edit the color, name and loop attributes of an element.\n\nPre-programmed cellular automata include:\n\n- [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) (with a non-looped variant as well)\n- [Brian's Brain](https://en.wikipedia.org/wiki/Brian%27s_Brain)\n- [Seeds](https://en.wikipedia.org/wiki/Seeds_%28cellular_automaton%29)\n- [Highlife](https://en.wikipedia.org/wiki/Highlife_%28cellular_automaton%29)\n- [Wireworld](https://en.wikipedia.org/wiki/Wireworld)\n- These Wolfram 2D rules\n  - [Rule 30](https://en.wikipedia.org/wiki/Rule_30)\n  - [Rule 90](https://en.wikipedia.org/wiki/Rule_90)\n  - [Rule 110](https://en.wikipedia.org/wiki/Rule_110)\n  - [Rule 184](https://en.wikipedia.org/wiki/Rule_184)\n- These custom elements\n  - Blocks (They do nothing but serve as a valuable obstacle)\n  - Water (Flows like water)\n  - Acid (Destroys everything it touches, including itself)\n\n## Getting Started with the library\n\n### NPM Package\n\nIn your project run one of these:\n\n- For pnpm, `pnpm i --save pixelmanipulator`\n- For npm, `npm i --save pixelmanipulator`\n\nIf you are using esmodules, you now can import it like this:\n\n```ts\nimport { PixelManipulator, rules, Ctx2dRenderer } from 'pixelmanipulator'\n```\n\nA great starting point is [this console-only demo][console demo].\n\nTo run the node demo\n\n1. Clone this repo.\n2. `npm i`\n3. `npm run node-demo`\n\nFor documentation, [![View the Docs][vtdosvg]][the docs]\n\n[console demo]: https://github.com/Lazerbeak12345/pixelmanipulator/blob/master/src/node-demo/index.ts\n\n### Old-school\n\nStart with this html:\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cscript src=\"https://unpkg.com/pixelmanipulator@^5.5.7\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ccanvas id=\"myCanvas\"\u003e\u003c/canvas\u003e\n    \u003cscript\u003e\n      var canvas = document.getElementById(\"myCanvas\")\n\n      // Create a renderer that renders on that canvas\n      var renderer = new pixelmanipulator.Ctx2dRenderer(canvas)\n\n      // Create a PixelManipulator, setting the size to 400 by 400\n      var p = new pixelmanipulator.PixelManipulator(renderer, 400, 400)\n\n      // An example element to get you started.\n      var gol = p.addElement( {\n        name: \"Conway's Game Of Life\",\n\n        // born on 3, survives on 2 or 3\n        ...pixelmanipulator.rules.lifelike(p, 'B3/S23'),\n\n        // the rgb color\n        renderAs: [0, 255, 0]\n      })\n\n      // If your browser doesn't support spread syntax\n      // (that's the `...`), then this works too!\n      var rule_ninety = p.addElement({\n        name: \"Rule 90\",\n        renderAs: [147, 112, 219]\n      })\n      p.modifyElement(rule_ninety, pixelmanipulator.rules.wolfram(p, 'Rule 90'))\n\n      // Randomly fill 15% of the canvas with \"Conway's Game of Life\"\n      p.randomlyFill(gol, 15)\n\n      // Watch it go!\n      p.play()\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nPixelmanipulator supports various browser-side module loaders, such as\n\n- CommonJS (CJS)\n- Asynchronus Module Definition (AMD)\n- And also supports a fallback to the namespaced global variable\n  `pixelmanipulator`\n\nFor documentation, [![View the Docs][vtdosvg]][the docs]\n\n## What is Conway's game of Life\n\nConway's game of life is a cellular automata with a few simple rules.\nAll of these rules use a distance formula where it counts the both the pixels\nthat are immidately touching the edges and the pixels that are immidately\ntouching the corners.\nFor example (givin that `O` is the cell, and `X` is one that is checked in the\nmoore distance fourmula):\n\n    XXX\n    XOX\n    XXX\n\nOn an empty cell, if there are exactly three(3) living cells around it, then it\nis born.\nA cell will remain alive if there are exactly two(2) or three(3) living cells\nnearby.\nElsewise, the cell either remains dead, or becomes dead.\n\n### Adding a basic life-type cellular automata\n\nFor life-type cellular automata (cellular automata that are like Conway's game\nof Life, but have different rules), there is a specific syntax for how to\nspecify them: `B3/S23`. This syntax literally means \"born on three(3), survive\non two(2) or three(3).\"\n\nThe example code above included `B2/S23` (AKA \"Conway's game of Life\") as an example. Feel free to try out other patterns, like\n\n- Seeds `B2/S`\n- Highlife `B36/S23`\n- And more! (262144 combinations, `2^(9+9)`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazerbeak12345%2Fpixelmanipulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazerbeak12345%2Fpixelmanipulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazerbeak12345%2Fpixelmanipulator/lists"}