Following these instructions I already have a WebGL Earth globe in an Angular component up and working. But writing this WebGL Earth animation (rotating) example animate function in to the typescript Angular component throws all sorts of errors. It's also important to include this start and stop at the same location into the animate (rotate) function.
So how to write this:
var before = null;
requestAnimationFrame(function animate(now) {
var c = earth.getPosition();
var elapsed = before? now - before: 0;
before = now;
earth.setCenter([c[0], c[1] + 0.1*(elapsed/30)]);
requestAnimationFrame(animate);
});
In to typescript.
The trickiest part I'm finding is this:
requestAnimationFrame(function animate(now) {
callback ? recursive function ? from JavaScript into TypeScript. But also the
var before = null;
assignment.
I will post again with my next attempt/ update! Thanks!