1 / 7

CUSTOM SHAPES

CUSTOM SHAPES. beginShape () and endShape () These allow creating more complex forms. beginShape ()  begins recording vertices for a shape and  endShape ()  stops recording After calling the  beginShape ()  function, a series of  vertex()  commands must follow . SYNTAX beginShape ()

draco
Download Presentation

CUSTOM SHAPES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CUSTOMSHAPES

  2. beginShape() and endShape() • These allow creating more complex forms. • beginShape() begins recording vertices for a shape and endShape() stops recording • After calling the beginShape() function, a series of vertex() commands must follow. SYNTAX • beginShape() • beginShape(MODE) MODE • POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP

  3. vertex() • is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons and is used exclusively within thebeginShape()andendShape() function.  SYNTAX vertex(x, y); • x-coordinate of the vertex • y-coordinate of the vertex

  4. //DRAWING AN ARROW size(480, 120); beginShape(); vertex(180, 82); vertex(207, 36); vertex(214, 63); vertex(407, 11); vertex(412, 30); vertex(219, 82); vertex(226, 109); endShape();

  5. //Closing the Gap of the arrow size(480, 120); beginShape(); vertex(180, 82); vertex(207, 36); vertex(214, 63); vertex(407, 11); vertex(412, 30); vertex(219, 82); vertex(226, 109); endShape(CLOSE);

  6. //CREATING SOME CREATURE size(480, 120); smooth(); // Left creature beginShape(); vertex(50, 120); vertex(100, 90); vertex(110, 60); vertex(80, 20); vertex(210, 60); vertex(160, 80); vertex(200, 90); vertex(140, 100); vertex(130, 120); endShape(); fill(0); ellipse(155, 60, 8, 8);

  7. // Right creature fill(255); beginShape(); vertex(370, 120); vertex(360, 90); vertex(290, 80); vertex(340, 70); vertex(280, 50); vertex(420, 10); vertex(390, 50); vertex(410, 90); vertex(460, 120); endShape(); fill(0); ellipse(345, 50, 10, 10);

More Related