Skip to content

beginShape_

villares edited this page May 24, 2020 · 4 revisions

Nome

beginShape()

Exemplos

beginShape(); 
vertex(30, 20); 
vertex(85, 20); 
vertex(85, 75); 
vertex(30, 75); 
endShape(); 
beginShape(POINTS); 
vertex(30, 20); 
vertex(85, 20); 
vertex(85, 75); 
vertex(30, 75); 
endShape(); 
beginShape(LINES); 
vertex(30, 20); 
vertex(85, 20); 
vertex(85, 75); 
vertex(30, 75); 
endShape(); 
beginShape(LINE_STRIP); 
vertex(30, 20); 
vertex(85, 20); 
vertex(85, 75); 
vertex(30, 75); 
endShape(); 
beginShape(LINE_LOOP); 
vertex(30, 20); 
vertex(85, 20); 
vertex(85, 75); 
vertex(30, 75); 
endShape(); 
beginShape(TRIANGLES); 
vertex(30, 75); 
vertex(40, 20); 
vertex(50, 75); 
vertex(60, 20); 
vertex(70, 75); 
vertex(80, 20); 
endShape(); 
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(); 
beginShape(TRIANGLE_FAN); 
vertex(57.5, 50); 
vertex(57.5, 15); 
vertex(92, 50); 
vertex(57.5, 85); 
vertex(22, 50); 
vertex(57.5, 15); 
endShape(); 
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(); 
beginShape(QUAD_STRIP); 
vertex(30, 20); 
vertex(30, 75); 
vertex(50, 20); 
vertex(50, 75); 
vertex(65, 20); 
vertex(65, 75); 
vertex(85, 20); 
vertex(85, 75); 
endShape(); 
beginShape(POLYGON); 
vertex(20, 20); 
vertex(40, 20); 
vertex(40, 40); 
vertex(60, 40); 
vertex(60, 60); 
vertex(20, 60); 
endShape(); 

Descrição

O uso das funçõesbeginShape() ** eendShape()** permite a criação de formas mais complexas. A funçãobeginShape() inicia o armazenmento dos vértices de uma forma eendShape() o interrompe. O valor do parâmetroMODO LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP, e POLYGON. especifica qual o tipo de formas serão criadas a partir dos vértices providos. Os par6ametros disponíveis para beginShape() são  Caso não hajaMODO especificado, o padrão utilizado é POLYGON. Após a chamada a funçãobeginShape(), deve seguir uma série de comandosvertex().  Para se parar o desenho da forma, chama-seendShape(). Enguanto a funçãovertex()  com dois parâmetros especifica uma posição em 2D, uma com tr6es parâmetros  especifica uma posição em 3D. Cada forma será delineada com a cor do traço corrente e preenchida com  a atual cor de preenchimento.   Transformações geométricas comotranslate(),rotate(), escale() não funcionam no escopo debeginShape().

Sintaxe

beginShape(<font color="#996600">MODE</font>)
Parâmetros MODE qualquer um entre: LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP, ou  POLYGON

Retorno

Nenhum

Utilização

Web & Applicações

Relacionado

endShape()vertex()curveVertex()bezierVertex()

Clone this wiki locally