Seeking assistance from someone knowledgeable in three.js to help troubleshoot my code for creating a moving sphere. I've reviewed several examples incorporating json data, but they all seem quite intricate. Any help is appreciated!
Here are snippets of my code:
function animate(t) {
camera.lookAt(scene.position);
// renderer automatically clears unless autoClear = false
//window.requestAnimationFrame(animate, renderer.domElement);
requestAnimationFrame(animate);
render();
}
function render(){
renderer.render(scene,camera);
}
function updateSpheres(pos1, pos2){
var geometry = new THREE.SphereGeometry( 10, 10, 10 );
var violetMaterial = new THREE.MeshBasicMaterial( { color: 0x6259CA , transparent: true, opacity: 0.5 } );
sphereAnimate = new THREE.Mesh( geometry, violetMaterial)
scene.add(sphereAnimate);
var animationData = {
"name" : "Action",
"fps" : 3,
"length" : 2.0,
"hierarchy" : [
{
"parent" : -1, //root
"keys" : [
{
"time":0,
"pos" :[0,0,0],
"rot" :[0,0,0],
"scl" :[1,1,1]
},
{
"time":1.0,
"pos" :[3,0,3],
"rot" :[0,0,0],
"scl" :[1,1,1]
},
{
"time":2.0,
"pos" :[0,60,0],
"rot" :[0,0,0],
"scl" :[1,1,1]
}
]
}
]
};
console.log(geometry);
var sphereMeshAnimation = new THREE.Animation( sphereAnimate, animationData );
//ensureLoop( animationData );
sphereMeshAnimation.play();
//sphereMeshAnimation.update(0);
}