S
S
serhii3287642018-09-24 13:23:37
JavaScript
serhii328764, 2018-09-24 13:23:37

How to control animation in Three.js?

Hey! A globe is built on a project using three.js, on which there are dots of countries. When you click on a country point, the globe scrolls to the desired point. How to control this animation? Ideally, get an animation end event to execute related code.
Now it looks like this:

raycaster.setFromCamera(mouse, camera);
const intersects = raycaster.intersectObjects(scene.children);

If there is an intersection with the layer of the point of the desired country, then the coordinates are set:
target.x and target.y and the globe starts spinning.
How to manage this animation?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question