void turtle() { P5JSExtension.background(51); P5JSExtension.resetMatrix(); P5JSExtension.translate(P5JSExtension.width / 2, P5JSExtension.height); P5JSExtension.stroke(255); for (int i = 0; i < sentence.Length; i++) { var current = sentence[i]; if (current == 'F') { P5JSExtension.line(0, 0, 0, -len); P5JSExtension.translate(0, -len); } else if (current == '+') { P5JSExtension.rotate(angle); } else if (current == '-') { P5JSExtension.rotate(-angle); } else if (current == '[') { P5JSExtension.push(); } else if (current == ']') { P5JSExtension.pop(); } } }
void OnGUI() { P5JSExtension.resetMatrix(); P5JSExtension.background(51); angle = slider.value; P5JSExtension.stroke(255); P5JSExtension.translate(P5JSExtension.width / 2, P5JSExtension.height); branch(100); }
void OnGUI() { P5JSExtension.resetMatrix(); P5JSExtension.background(51); for (int i = 0; i < tree.Count; i++) { tree[i].show(); //tree[i].jitter(); } for (var i = 0; i < leaves.Count; i++) { P5JSExtension.fill(255, 0, 100, 100); P5JSExtension.noStroke(); //cause error for somereason P5JSExtension.ellipse(leaves[i].x, leaves[i].y, 8, 8); leaves[i].y += P5JSExtension.random(0, 2); } }