Skip to content

Commit

Permalink
Fix bottom-most trunk segment thickness
Browse files Browse the repository at this point in the history
Call `@branch()` after `@trunk_width` is defined.
  • Loading branch information
1j01 committed Mar 4, 2023
1 parent 69fdc99 commit a8109b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/entities/PuffTree.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ module.exports = class PuffTree extends Tree
addEntityClass(@)
constructor: ->
super()
@branch(from: "base", to: "1", juice: Math.random()*10+5, width: @trunk_width, length: 9, angle: -TAU/2)

@bbox_padding = 30

@bbox_padding = 60

@trunk_width = 10+Math.floor(Math.random()*5)
@random_seed = performance.now()+Date.now()+Math.random()

@branch(from: "base", to: "1", juice: Math.random()*10+5, width: @trunk_width, length: 9, angle: -TAU/2)

branch: ({from, to, juice, angle, width, length})->
name = to
angle+=(Math.random()*2-1)*0.7
Expand Down

0 comments on commit a8109b0

Please sign in to comment.