highlight cerebellum
This commit is contained in:
parent
3e65f90d12
commit
376701c1e9
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 287 KiB |
@ -46,14 +46,34 @@ canvas.appendChild( renderer.domElement );
|
|||||||
scene.add(light.target);
|
scene.add(light.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var brain = null;
|
||||||
const objLoader = new THREE.GLTFLoader();
|
const objLoader = new THREE.GLTFLoader();
|
||||||
objLoader.load('assets/brain.gltf', (root) => {
|
objLoader.load('assets/brain.gltf', (root) => {
|
||||||
scene.add(root.scene.children[2]);
|
console.log(root.scene.children[2]);
|
||||||
|
brain = root.scene.children[2];
|
||||||
|
brain.children[5].material.emissive = new THREE.Color('black');
|
||||||
|
scene.add(brain);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const cerebellumHighlightColor = new THREE.Color(0x9D6720);
|
||||||
|
const originalColor = new THREE.Color('black');
|
||||||
|
var highlightColors = [cerebellumHighlightColor, originalColor];
|
||||||
|
var highlightProgress = 0;
|
||||||
|
var highlightIndex = 0;
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
|
|
||||||
|
if (brain) {
|
||||||
|
highlightProgress += 0.025;
|
||||||
|
brain.children[5].material.emissive.lerp(highlightColors[highlightIndex], highlightProgress);
|
||||||
|
|
||||||
|
if (highlightProgress >= 1) {
|
||||||
|
highlightProgress = 0;
|
||||||
|
highlightIndex = (highlightIndex + 1) % 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
requestAnimationFrame(render);
|
requestAnimationFrame(render);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user