Files
processing4/mobile/web/reference/API/beginShape.xml
2005-01-27 06:48:42 +00:00

171 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>beginShape()</name>
<category>Shape</category>
<subcategory>Vertex</subcategory>
<usage>Web &amp; Application</usage>
<example>
<image>beginShape_.gif</image>
<code>
beginShape(POINTS);
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape();
</code>
</example>
<example>
<image>beginShape_2.gif</image>
<code>
beginShape(LINES);
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape();
</code>
</example>
<example>
<image>beginShape_3.gif</image>
<code>
beginShape(LINE_STRIP);
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape();
</code>
</example>
<example>
<image>beginShape_4.gif</image>
<code>
beginShape(LINE_LOOP);
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape();
</code>
</example>
<example>
<image>beginShape_5.gif</image>
<code>
beginShape(TRIANGLES);
vertex(30, 75);
vertex(40, 20);
vertex(50, 75);
vertex(60, 20);
vertex(70, 75);
vertex(80, 20);
vertex(90, 75);
endShape();
</code>
</example>
<example>
<image>beginShape_6.gif</image>
<code>
beginShape(TRIANGLE_STRIP);
vertex(30, 75);
vertex(40, 20);
vertex(50, 75);
vertex(60, 20);
vertex(70, 75);
vertex(80, 20);
vertex(90, 75);
endShape();
</code>
</example>
<example>
<image>beginShape_7.gif</image>
<code>
beginShape(QUADS);
vertex(30, 20);
vertex(30, 75);
vertex(50, 75);
vertex(50, 20);
vertex(65, 20);
vertex(65, 75);
vertex(85, 75);
vertex(85, 20);
endShape();
</code>
</example>
<example>
<image>beginShape_8.gif</image>
<code>
beginShape(QUAD_STRIP);
vertex(30, 20);
vertex(30, 75);
vertex(50, 75);
vertex(50, 20);
vertex(65, 20);
vertex(65, 75);
vertex(85, 75);
vertex(85, 20);
endShape();
</code>
</example>
<example>
<image>beginShape_9.gif</image>
<code>
beginShape(POLYGON);
vertex(20, 20);
vertex(40, 20);
vertex(40, 40);
vertex(60, 40);
vertex(60, 60);
vertex(20, 60);
endShape();
</code>
</example>
<description>
Using the <b>beginShape()</b> and <b>endShape()</b> functions allow creating more complex forms. <b>beginShape()</b> begins recording vertices for a shape and endShape() stops recording. The <b>beginShape()</b> function requires a parameter to tell it which type of shape to create from the provided vertices. The parameters available for beginShape() are LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_STRIP, QUADS, QUAD_STRIP, and POLYGON. After calling the <b>beginShape()</b> function, a series of <b>vertex()</b> commands must follow. To stop drawing the shape, call <b>endShape()</b>. The <b>vertex()</b> function with two parameters specifies a position in 2D and the vertex() function with three parameters specifies a position in 3D. Each shape will be outlined with the current stroke color and filled with the fill color. Transformations such as <b>translate()</b>, <b>rotate()</b>, and <b>scale()</b> do not work within <b>beginShape()</b>.
</description>
<syntax>
beginShape(<c>MODE</c>)
</syntax>
<parameter>
<label>MODE</label>
<description>Either LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_STRIP, QUADS, QUAD_STRIP, POLYGON</description>
</parameter>
<returns>None</returns>
<related>
endShape()
vertex()
curveVertex()
bezierVertex()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>