{"id":18371048,"url":"https://github.com/emptyflash/bl4st","last_synced_at":"2025-04-13T22:50:49.244Z","repository":{"id":149693460,"uuid":"606438208","full_name":"emptyflash/bl4st","owner":"emptyflash","description":"Livecodable fractal flames ","archived":false,"fork":false,"pushed_at":"2023-03-14T18:04:34.000Z","size":3420,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T13:06:27.651Z","etag":null,"topics":["flam3","fractal","ifs","livecoding"],"latest_commit_sha":null,"homepage":"https://emptyfla.sh/bl4st","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/emptyflash.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":"2023-02-25T13:51:44.000Z","updated_at":"2024-11-24T23:37:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"92232ffd-86af-4373-ba31-3379594f2363","html_url":"https://github.com/emptyflash/bl4st","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/emptyflash%2Fbl4st","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emptyflash%2Fbl4st/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emptyflash%2Fbl4st/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emptyflash%2Fbl4st/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emptyflash","download_url":"https://codeload.github.com/emptyflash/bl4st/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794559,"owners_count":21162614,"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":["flam3","fractal","ifs","livecoding"],"created_at":"2024-11-05T23:42:47.607Z","updated_at":"2025-04-13T22:50:49.222Z","avatar_url":"https://github.com/emptyflash.png","language":"JavaScript","readme":"# bl4st\n\nLivecodable real-time fractal flames in the browser.\n\n[Flam3's](https://flam3.com/) are a type of Iterated Function System that\ngenerate fractals that can look similar to flames.\n\nThis is a very computationly expensive operation that can be tricky to\nparallelize. Thanks to [Orion Sky Lawlor](https://www.cs.uaf.edu/~olawlor/2011/gpuifs/)\nand [Juergen Wothke](http://www.wothke.ch/ablaze/) we can build and run flames in \nreal-time in the browser.\n\nThe goal is to provide a framework to for accelerate exploration of and performance\nwith fractal flames.\n\n\n## Guide\n\nFlames configs can be built by calling the `flame` function, and setting various properties\nof the flame:\n```\nflame()\n    .colorful(.4)\n    .exposure(3)\n```\n\nFlames are essentially a set of transforms applied recursively to an initial state. These\ntransforms apply some affine transformation on the coordinate system using the `x`, `y`, and `o`\nvector properties and a `wvar` scalar. The result of this affine transformation is fed into\nthe a function based on the `variation`, which further alters the coordinate system.\n\nFor example, if you wanted to add a linear (just the affine part) transform to a flame you could do:\n\n```\nflame()\n  .colorful(.4)\n  .exposure(3)\n  .addTransform(\n    transform()\n    .linear()\n    .x([1.05,0])\n    .y([0,1.05])\n    .o([0, 0])\n  )\n```\n\nThis is essentially taking the initial state (just a square), stretching it out, and mapping the\noutput intensity to some color.\n\nThings get more intersting if we start stacking transforms and playing with the `o` vector:\n\n```\nflame()\n  .colorful(.4)\n  .exposure(3)\n  .addTransform(\n    transform()\n    .linear()\n    .x([1,0])\n    .y([0,1])\n    .o([0.1, 0.1])\n  )\n  .addTransform(\n    transform()\n    .linear()\n    .x([0, -1])\n    .y([0.2, 0])\n    .o([0, 0])\n  )\n```\n\nCheck out the full list of [supported variations](README.md#Variations)\n\nTransforms can also be animated over time by providing any of the properties a function:\n```\nflame()\n  .colorful(.4)\n  .exposure(3)\n  .addTransform(\n    transform()\n    .linear()\n    .x([1,0])\n    .y([0,1])\n    .o([0.1, 0.1])\n  )\n  .addTransform(\n    transform()\n    .linear()\n    .x(({time}) =\u003e [0, Math.sin(time)])\n    .y(({time}) =\u003e [Math.cos(time), 0])\n    .o([0, 0])\n  )\n```\n\nFor convenience, you can also make any of the vectors rotate over time by supplying\n`angle`, `speed`, and `radius` (which can also be functions).\n```\nflame()\n  .colorful(.4)\n  .exposure(3)\n  .addTransform(\n    transform()\n    .linear()\n    .x([1,0])\n    .y([0,1])\n    .rotateO(1, 1, ({time})=\u003eMath.abs(Math.sin(time)))\n  )\n  .addTransform(\n    transform()\n    .linear()\n    .x([0, -1])\n    .y([0.2, 0])\n  )\n```\n\n\n## Variations\n\nThe following transform variations are supported:\n* linear\n* sinusoidal\n* spherical\n* swirl\n* horseshoe\n* polar\n* handkerchief\n* heart\n* disc\n* spiral\n* hyperbolic\n* diamond\n* ex\n* julia\n* bent\n* fisheye\n* exponential\n* power\n* cosine\n\nThis is only a subset of the [standard flam3 variations](https://github.com/scottdraves/flam3/wiki/Catalog-of-Variations#flam3-28-variations)\ndue to limitations around running on the GPU. If you can come up with the inverse for \nany of these variation functions, please submit a PR!\n\n## More Examples\n\n```\nflame()\n  .screenInitScale(.2)\n  .screenInitVal(.8)\n  .colorful(0.4)\n  .mapExposure(1.6)\n  .addTransform(\n    transform()\n    .linear()\n    .weight(.8)\n    .o(({time}) =\u003e [Math.sin(time/5), Math.sin(time/3)])\n    .build()\n  )\n  .addTransform(\n    transform()\n    .weight(.1)\n    .fisheye()\n    .x([.1,8])\n    .y([4,.1])\n    .y([7,.1])\n    .build()\n  )\n  .iterations(4)\n  .firstLevel(7)\n  .lastLevel(12)\n```\n\n### Using bl4st in hydra\n\n```\nawait import(\"https://emptyfla.sh/bl4st/bundle-global.js\")\n\nflameEngine.setConfig(\n\tflame()\n\t.colorful(.7)\n\t.mapExposure(2)\n\t.addTransform(\n\t\ttransform()\n\t\t.hyperbolic()\n\t\t.rotateX()\n\t\t.build()\n\t)\n\t.addTransform(\n\t\ttransform()\n\t\t.fisheye()\n\t\t.rotateY()\n\t\t.build()\n\t)\n\t.addTransform(\n\t\ttransform()\n\t\t.fisheye()\n\t\t.rotateO()\n\t\t.build()\n\t)\n)\n\nflameEngine.start()\n\ns0.init({\n\tsrc: flameEngine.canvas\n})\n\nsrc(o0)\n\t.layer(\n\t\tsrc(s0)\n\t\t.luma())\n\t.scale(1.002)\n\t.modulateRotate(noise(1), .01)\n\t.out()\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femptyflash%2Fbl4st","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femptyflash%2Fbl4st","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femptyflash%2Fbl4st/lists"}