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.background(230, 230, 250); for (int i = 0; i < drops.Length; i++) { drops[i].fall(); drops[i].show(); } }
public Star() { P5JSExtension.background(0); x = P5JSExtension.random(-P5JSExtension.width, P5JSExtension.width); y = P5JSExtension.random(-P5JSExtension.height, P5JSExtension.height); z = P5JSExtension.random(0, P5JSExtension.width); pz = z; }
void OnGUI() { P5JSExtension.background(200); for (var i = 0; i < cells.Count; i++) { cells[i].move(); cells[i].show(); } }
void OnGUI() { P5JSExtension.background(51); s.Show(); P5JSExtension.fill(255, 0, 100); P5JSExtension.rect(food.x, food.y, scl, scl); }
void OnGUI() { P5JSExtension.resetMatrix(); P5JSExtension.background(51); angle = slider.value; P5JSExtension.stroke(255); P5JSExtension.translate(P5JSExtension.width / 2, P5JSExtension.height); branch(100); }
void Start() { rules[0] = new Rule { a = "F", b = "FF+[+F-F-F]-[-F+F+F]" }; angle = P5JSExtension.radians(25); P5JSExtension.background(51); }
void OnGUI() { speed = P5JSExtension.map(Input.mousePosition.x, 0, P5JSExtension.width, 0, 20); P5JSExtension.background(0); for (int i = 0; i < 800; i++) { stars[i].Update(); stars[i].Show(); } }
void OnGUI() { P5JSExtension.background(51); ship.show(); ship.move(); for (var i = 0; i < drops.Count; i++) { drops[i].show(); drops[i].move(); for (var j = 0; j < flowers.Count; j++) { if (drops[i].hits(flowers[j])) { flowers[j].grow(); drops[i].evaporate(); } } } var edge = false; for (var i = 0; i < flowers.Count; i++) { flowers[i].show(); flowers[i].move(); if (flowers[i].x > P5JSExtension.width || flowers[i].x < 0) { edge = true; } } if (edge) { for (var i = 0; i < flowers.Count; i++) { flowers[i].shiftDown(); } } for (var i = drops.Count - 1; i >= 0; i--) { if (drops[i].toDelete) { drops.RemoveAt(i); } } }
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); } }
void OnGUI() { m = slider.value; P5JSExtension.background(51); var radius = 100; var total = 100; var increment = (2 * Mathf.PI) / total; P5JSExtension.beginShape(MeshTopology.LineStrip); for (float angle = 0; angle < 2 * Mathf.PI; angle += increment) { var r = supershape(angle); var x = radius * r * Mathf.Cos(angle); var y = radius * r * Mathf.Sin(angle); P5JSExtension.vertex(x, y); } gameObject.GetComponent <MeshFilter>().mesh = P5JSExtension.endShape(P5JSExtension.CLOSED); }
void OnGUI() { P5JSExtension.background(51); tree.show(); tree.grow(); }