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;
object.castShadow = true;
object.receiveShadow = true;
scene.add(object);
objects.push(object);
ax = ax + 100;
if (ax > 300) {
ax = -400;
ay = ay + 100;
}
if (ay > 300) {
ay = -400;
az = az + 100;
}
}
}
Member
200 Points
691 Posts
move all the ccolored cubes in one corner
Aug 22, 2016 12:49 PM|Lexi85|LINK
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
Member
540 Points
130 Posts
Re: move all the ccolored cubes in one corner
Aug 23, 2016 05:00 AM|Ailleen|LINK
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/
There are tutorials about it.
https://www.youtube.com/watch?v=rqn-KPnh3hM
http://benchung.com/three-js-editor/
Best Regards,
Ailleen
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.