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(); } } }
public void show() { if (parent != null) { P5JSExtension.stroke(255); P5JSExtension.line(this.pos.x, this.pos.y, this.parent.pos.x, this.parent.pos.y); } }
public void show() { float thick = P5JSExtension.map(z, 0, 20, 1, 3); P5JSExtension.strokeWeight(thick); P5JSExtension.stroke(138, 43, 226); P5JSExtension.line(x, y, x, y + len); }
void OnGUI() { P5JSExtension.resetMatrix(); P5JSExtension.background(51); angle = slider.value; P5JSExtension.stroke(255); P5JSExtension.translate(P5JSExtension.width / 2, P5JSExtension.height); branch(100); }
public void show() { P5JSExtension.stroke(255); P5JSExtension.line(this.begin.x, this.begin.y, this.end.x, this.end.y); }