3d - Three.js morphAnimMesh animation doesn't update -
recently i've spent time digging three.js. created 3d model in blender , import three.js. works fine, data inside morphanimmesh currentkeyframe , lastkeyframe both updating, doesn't render animation, static 3d object. can give me help? thanks.
this url of work: http://www.dustedge.com/mathspace/three_test2.html
all codes here:
var scene = new three.scene(); var camera = new three.perspectivecamera(75, window.innerwidth/window.innerheight, 0.1, 1000); var histlookvector = new three.vector3(1,1,1); var currentlookvector = new three.vector3(1,1,1); var xaxis = new three.vector3(1,0,0); var yaxis = new three.vector3(0,1,1); var renderer = new three.webglrenderer(); var mesh; var time; var oldtime; var delta; renderer.setsize(window.innerwidth, window.innerheight); document.body.appendchild(renderer.domelement); camera.position.x = -20; camera.position.y = 20; camera.position.z = 20; camera.lookat(currentlookvector); var x=0; var loader = new three.jsonloader(); loader.load( "nets.js", creategeometry ); function creategeometry(model){ var material = new three.meshnormalmaterial({morphtargets:true}); mesh = new three.morphanimmesh(model, material); mesh.scale.x = mesh.scale.y = mesh.scale.z = 4; mesh.position.x = 10; mesh.time = 0; mesh.duration = 2000; oldtime = time = new date().gettime(); scene.add(mesh); render(); } function render() { requestanimationframe(render); time= new date().gettime(); delta= time-oldtime; oldtime=time; if(mesh){ mesh.updateanimation(delta); //console.log('current: ' + geometry.currentkeyframe); } renderer.render(scene, camera); }
Comments
Post a Comment