Search the Community
Showing results for tags 'isStopped'.
-
I've been trying to add a animation end callback function to David Rousset's very handy animateCameraPositionAndRotation function http://blogs.msdn.co...babylon-js.aspx but I can't seem to get a animation end callback to work. The camera animation works great but at the end of it nothing happens. I'm trying to use "isStopped" but I just can't get it to fire when the animation ends. I'm not even sure I'm barking up the right tree. And to be honest my javascript understanding of object methods and event listeners is marginal. Ive tried 1. if (animCamRotation.isStopped()) { alert('stopped'); } (inside the animateCameraPositionAndRotation function) 2. if (animCamRotation.isStopped()) { alert('stopped'); } (inside the engine.runRenderLoop) 3. And a few others that broke the script entirely Am I in the balpark at all? Here is the function var animateCameraPositionAndRotation = function (freeCamera, fromPosition, toPosition, fromRotation, toRotation) { var animCamPosition = new BABYLON.Animation("animCam", "position", 30, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keysPosition = []; keysPosition.push({ frame: 0, value: fromPosition }); keysPosition.push({ frame: 10, value: toPosition }); animCamPosition.setKeys(keysPosition); animCamRotation = new BABYLON.Animation("animCam", "rotation", 30, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keysRotation = []; keysRotation.push({ frame: 0, value: fromRotation }); keysRotation.push({ frame: 10, value: toRotation }); animCamRotation.setKeys(keysRotation); freeCamera.animations.push(animCamPosition); freeCamera.animations.push(animCamRotation); scene.beginAnimation(freeCamera, 0, 10, false); };