Slide 57
Slide 57 text
Switch Color of Box
function addBox(position){
// Create an element named a-box
var box = document.createElement('a-box');
// Set the position, size, and color
box.setAttribute('position', position);
box.setAttribute('scale', '0.02 0.02 0.02ʼ);
box.setAttribute('color', '#0062C6');
box.setAttribute('color', colors[index]);
// Set class names for easy deletion later
box.setAttribute('class', 'box');
// Add a box in 3D space
scene.appendChild(box);
// Memorize the position where the box was placed
prev=box.object3D.position;
} Lesson13
box.setAttribute('color', '#0062C6');