2D Mesh
A Mesh
object created with raw vertices, indices and colors.
// Create a new Mesh object
mesh = new Mesh();
// Mesh position
mesh.pos(
screen.width * 0.5 - 100,
screen.height * 0.5 - 100
);
// Mesh vertices
mesh.vertices = [
0, 0,
200, 0,
200, 200,
0, 200
];
// Mesh triangles
mesh.indices = [
0, 1, 2,
0, 2, 3
];
// Mesh (random) colors
mesh.colorMapping = VERTICES;
mesh.colors = [
new AlphaColor(Color.random()),
new AlphaColor(Color.random()),
new AlphaColor(Color.random()),
new AlphaColor(Color.random())
];
Next example ➔ Text