# move all the ccolored cubes in one corner RSS

Last post Aug 23, 2016 05:00 AM by Ailleen

• Lexi85

Member

200 Points

691 Posts

### move all the ccolored cubes in one corner

Hello

I have below code which creates a cube out of cubes with a random transparent...I want to display the colored ones in one corner and transparent ones in the other corner of the cube...how do I do that

```if (resultlabel == 4) {
var geometry = new THREE.BoxGeometry(50, 50, 50);

var ax = ay = az = -400;

for (var i = 0; i < 512; i++) {
var newColor;
var opaqueness = 0.8;
var colornum = Math.floor(Math.random() * 4);
if (colornum == 0) newColor = 0x04B45F;
if (colornum == 1) {
newColor = 0x04B45F;
opaqueness = 0.05;
}
if (colornum == 2) {
newColor = 0x04B45F;
opaqueness = 0.05;
}
if (colornum == 3) {
newColor = 0x04B45F;
opaqueness = 0.05;
}
if (colornum == 4)
newColor = 0x04B45F;

if (colornum == 5) {
newColor = 0x04B45F;
opaqueness = 0.05;
}
if (colornum == 3)
newColor = 0x04B45F;

var object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: newColor, transparent: true, opacity: opaqueness }));

object.position.x = ax;
object.position.y = ay;
object.position.z = az;

object.scale.x = 2;
object.scale.y = 2;
object.scale.z = 2;

objects.push(object);

ax = ax + 100;
if (ax > 300) {
ax = -400;
ay = ay + 100;
}
if (ay > 300) {
ay = -400;
az = az + 100;
}

}

}```

• Ailleen

Member

540 Points

130 Posts

### Re: move all the ccolored cubes in one corner

Hi Lexi85,

Did you used three.js? If it is, you could use the three.js editor. It will be helpful with you.

http://threejs.org/editor/