Properties:
color
(type: color) — default: whitecoords
(type: coord[]) — array of ordered points tracing the boundary of the polygon, aka. the polygon verticesedgeForm
(type: object) — default: {}
, object with the following properties:
color
(type: color) — edges’ color, default: blackshowEdges
(type: bool) — default: true
opacity
(type: number) — default: 1
vertexNormals
(type: number[3][]) — this is not commonly used. This changes the way the polygon reflects the light. If this is smaller than the number of total vertexNormals of the polygon, the other vertexNormals are going to be calculated in the shader. See vertex normal in Wikipedia. Default: []
Draw a polygon with no holes in it, it can be non-coplanar and non-triangular.
{
"type": "polygon",
"color": [1, 1, 1],
"coords": [
[[0, 0, 0]],
[[0, 0, 1]],
[[0, 1, 1]]
],
"opacity": 0.4 // 40% of opacity
}
{
"type": "polygon",
"color": [1, 1, 0],
"coords": [
[[0, 0, 0]],
[[0, 1, 0]],
[[0, 1, 1]],
[[0, 0, 1]]
]
}
{
"type": "polygon",
"color": [0, 0.5, 0.5],
"coords": [
[[0, 0, 0]],
[[0, 1, 1]],
[[1, 1, 1]],
[[1, 0, 1]]
],
"opacity": 0.9 // 90% of opacity
}
{
"type": "polygon",
"color": [0, 1, 1],
"coords": [
[[0, 0, 0]],
[[0, 1, 1]],
[[1, 1, 1]],
[[1, 0, 1]]
],
"edgeForm": { "showEdges": true }
}
{
"elements": [{
"type": "polygon",
"color": [1, 1, 1],
"coords": [
[[0, 0, 0]],
[[1, 1, 1]],
[[0, 1, 1]]
],
"vertexNormals": [
[1, -1, 1],
[1, -1, 1],
[1, -1, 1]
],
}],
"lighting": [{
"type": "point",
"color": [1, 1, 1],
"coords": [[1, 0, 1]]
}],
}