Skip to content

Commit

Permalink
Merge pull request #159 from bellesea/main
Browse files Browse the repository at this point in the history
fractalTree-maggieClaireBelle
  • Loading branch information
leomcelroy authored Nov 18, 2023
2 parents 5e9b928 + ebf93ae commit c495832
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions art/fractalTree-maggieClaireBelle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Fractal trees by Maggie, Claire and Belle

const t = createTurtle();

const MAX_ITERATION = randInRange(7, 10)
const START_ANGLE = 90
const ANGLE_CHANGE = randInRange(10, 20)
const BRANCH_LEN = randInRange(20, 30)
const START_POS = [62.5, 30]

function recurse(prevBranchEnd, angle, branchLen, iteration) {
if (iteration > MAX_ITERATION) {
return
}

// Left branch from a node
t.jump(prevBranchEnd)
t.setAngle(angle + ANGLE_CHANGE)
t.forward(branchLen)

recurse(t.end, angle + ANGLE_CHANGE, branchLen * 2/3, iteration + 1)

// Right branch from a node
t.jump(prevBranchEnd)
t.setAngle(angle - ANGLE_CHANGE)
t.forward(branchLen)

recurse(t.end, angle - ANGLE_CHANGE, branchLen * 2/3, iteration + 1)
}

recurse(START_POS, START_ANGLE, BRANCH_LEN, 1)

drawTurtles([t])
Binary file added art/fractalTree-maggieClaireBelle/snapshots/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/fractalTree-maggieClaireBelle/snapshots/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/fractalTree-maggieClaireBelle/snapshots/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit c495832

@vercel
Copy link

@vercel vercel bot commented on c495832 Nov 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blot – ./astro

blot-git-main.hackclub.dev
blot.hackclub.dev

Please sign in to comment.