{"id":16170456,"url":"https://github.com/corentinth/fractaltree","last_synced_at":"2025-06-12T08:36:13.536Z","repository":{"id":95926670,"uuid":"103855497","full_name":"CorentinTh/FractalTree","owner":"CorentinTh","description":"A recursive fractal tree generator.","archived":false,"fork":false,"pushed_at":"2017-10-04T08:40:15.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T07:34:42.367Z","etag":null,"topics":["angle","fractaltree","recursive-functions","reducer","tree"],"latest_commit_sha":null,"homepage":"http://divers.corentin-thomasset.fr/fractal-tree/index.html","language":"CSS","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/CorentinTh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-09-17T19:22:51.000Z","updated_at":"2023-09-08T17:30:07.000Z","dependencies_parsed_at":"2023-04-21T19:19:00.336Z","dependency_job_id":null,"html_url":"https://github.com/CorentinTh/FractalTree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CorentinTh/FractalTree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2FFractalTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2FFractalTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2FFractalTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2FFractalTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CorentinTh","download_url":"https://codeload.github.com/CorentinTh/FractalTree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2FFractalTree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259430824,"owners_count":22856358,"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":["angle","fractaltree","recursive-functions","reducer","tree"],"created_at":"2024-10-10T03:18:50.477Z","updated_at":"2025-06-12T08:36:13.515Z","avatar_url":"https://github.com/CorentinTh.png","language":"CSS","readme":"# FractalTree\n\n![image fractal tree](http://corentin-thomasset.fr/public/img1.PNG \"Image fractal tree\")\n\n## Description\nA javascript program that draw a fractal tree using recursive functions (function called by itself).\n\nTry it: [Live demo](http://divers.corentin-thomasset.fr/fractal-tree/index.html).\n\n## Recusive function\nHere is the recursive function: \n```javascript\nfunction drawBranch(lenght) {\n    // We draw the branch\n    ctx.moveTo(0,0);\n    ctx.lineTo(0,-lenght);\n    \n    // We move the orthonormal reference to end of the line.\n    ctx.translate(0, -lenght);\n\n    // To avoid infinite repetitions, we add new branches only if their length if greater than 4px\n    if (lenght \u003e 4) {\n        // We rotate the orthonormal reference clockwise...\n        ctx.save();\n        ctx.rotate(angle);\n        // ... and call the function with a reduced length\n        drawBranch(lenght * reducer);\n        ctx.restore();\n\n        // We rotate the orthonormal reference anti-clockwise...\n        ctx.save();\n        ctx.rotate(-angle);\n        // ... and call the function with a reduced length\n        drawBranch(lenght * reducer);\n        ctx.restore();\n    }\n}\n```\n\n## Parameters\nTheir is some sliders that permits to customize the tree.\n\n### Angle\nThe angle slider permits to set the angle between each new branch of the tree.\n\n### Length\nIt permits to set the initial length of a branch (the trunc at the begining).\n\n### Reducer\nIt permits to set the quotient of reduction at each generation of a branch. \n```Javascript\nlength_of_a_branch = length * reducer * number_of_generation \n```\nSo, the bigger the reducer the more branches you have (and more time it get to render).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentinth%2Ffractaltree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorentinth%2Ffractaltree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentinth%2Ffractaltree/lists"}