{"behavior_tree":{"result":"Running","relativeFilePath":"","parameters":[{"type":"Float","name":"pedalCount","value":[6.0,0.0,0.0,0.0]},{"type":"Float","name":"pedalI","value":[0.0,0.0,0.0,0.0]},{"type":"Float","name":"baseAngle","value":[0.0,0.0,0.0,0.0]},{"type":"Float","name":"parentI","value":[-1.0,0.0,0.0,0.0]},{"type":"Float","name":"size","value":[30.0,0.0,0.0,0.0]},{"type":"Float","name":"anglePerPedal","value":[0.0,0.0,0.0,0.0]}],"rootNode":{"name":"Start","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Create Root","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Create Root","position":[0.0,0.0],"type":"Sequence","childTreePath":"","currentChildI":-1,"children":[{"name":"Create Root","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Create Pedal","position":[0.0,0.0],"type":"ChildProcess","childTreePath":"grow_segment.json","currentChildI":-1,"onStart":"child.nodeI = parentI\nchild.targetDistance = random(50, 80)\nchild.startAngle = 0\nchild.endAngle = 0\nchild.distancePerSecond = 20","onUpdate":"","onDone":""}],"onStart":"\nStem.setNodeAngle(parentI, random(-10, 10))\nparentI = Stem.createNode(parentI, 0)","onUpdate":"","onDone":""},{"name":"For Loop","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Create Pedal","position":[0.0,0.0],"type":"ChildProcess","childTreePath":"grow_segments.json","childTree":{"result":"Running","relativeFilePath":"grow_segments.json","parameters":[{"type":"Float","name":"angle","value":[0.0,-1.0,0.0,0.0]},{"type":"Float","name":"targetDistance","value":[100.0,0.0,0.0,0.0]},{"type":"Float","name":"distancePerSecond","value":[60.0,0.0,0.0,0.0]},{"type":"Float","name":"parentI","value":[-1.0,0.0,0.0,0.0]},{"type":"Float","name":"nodeI","value":[-1.0,0.0,0.0,0.0]},{"type":"Float","name":"currentDistance","value":[0.0,0.0,0.0,0.0]},{"type":"Float","name":"currentSegmentCount","value":[0.0,0.0,0.0,0.0]},{"type":"Float","name":"segmentCount","value":[1.0,0.0,0.0,0.0]},{"type":"Float","name":"baseAngle","value":[0.0,0.0,0.0,0.0]},{"type":"Float","name":"newSegmentAngleSpan","value":[20.0,0.0,0.0,0.0]},{"type":"Float","name":"nodeType","value":[0.0,0.0,0.0,0.0]},{"type":"Float","name":"distanceAcceleration","value":[0.0,0.0,0.0,0.0]}],"rootNode":{"name":"Start","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Repeat","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Create Segment","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Repeat until done","position":[0.0,0.0],"type":"Decorator","childTreePath":"","currentChildI":-1,"children":[{"name":"Extend Segment","position":[0.0,0.0],"type":"Leaf","childTreePath":"","currentChildI":-1,"onStart":"","onUpdate":"currentDistance += dt * distancePerSecond\ncurrentDistance = min(currentDistance, targetDistance)\nStem.setNodeDistance(nodeI, currentDistance)\ndistancePerSecond += dt * distanceAcceleration","onDone":""}],"onStart":"","onUpdate":"","onDone":"if (result == Success && currentDistance < targetDistance) {\n    result = Running\n}"}],"onStart":"angle = random(-1, 1) * newSegmentAngleSpan\nif (currentSegmentCount == 0) {\n    angle += baseAngle\n}\nnodeI = Stem.createNode(parentI, angle)\nStem.setNodeType(nodeI, nodeType)\ncurrentSegmentCount += 1\ncurrentDistance = 0","onUpdate":"","onDone":"parentI = nodeI"}],"onStart":"currentSegmentCount = 0","onUpdate":"","onDone":"if (currentSegmentCount < segmentCount) {\n    result = Running\n}"}],"onStart":"","onUpdate":"","onDone":""}},"currentChildI":-1,"onStart":"angleSpan = (pedalCount - 1) * anglePerPedal\nprogress = pedalI / (pedalCount - 1)\nchild.baseAngle = baseAngle - angleSpan / 2 + pedalI * anglePerPedal\nchild.parentI = parentI\nchild.segmentCount = 1\nsizeFactor = (1 + 0.15 + 0.15 * cos(progress * 6.283))\nsizeFactorAmount = random(0, 1)\nsizeFactor = mix(1.2, sizeFactor, sizeFactorAmount)\nchild.targetDistance = size * sizeFactor\nchild.newSegmentAngleSpan = 0\nchild.nodeType = 2\nchild.distancePerSecond = 10 / sizeFactor\ncenterDistance = abs(progress - 0.5) / 0.5\nchild.distanceAcceleration = 5 * pow(1 - centerDistance, 2) * sizeFactor","onUpdate":"","onDone":""}],"onStart":"anglePerPedal = random(30, 40)\nsize = random(30, 50)","onUpdate":"","onDone":"if (pedalI < (pedalCount - 1)) {\n    result = Running\n    pedalI += 1\n}"}],"onStart":"","onUpdate":"","onDone":""}],"onStart":"if (parentI == -1) {\n    parentI = Stem.createNode(-1, 0)\n}","onUpdate":"","onDone":""}],"onStart":"","onUpdate":"","onDone":""}}}