【发布时间】:2021-04-13 04:44:10
【问题描述】:
我正在使用 worldwind nasa earth。
我创建了一组位置(每个位置都有不同的坐标),每次地球从一个位置移动到另一个位置时,我都需要运行一个函数。该函数必须在每次旋转结束时运行。
问题是在不同地点之间移动的时间不同(例如从意大利到美国,然后到英国)。
我已取消缩小 worldwind.js 文件并尝试在 t.prototype.goTo 函数中运行我的函数
(t.prototype.goTo = function (t, e) {
if (!t) throw new ArgumentError(d.logMessage(d.LEVEL_SEVERE, "GoToAnimator", "goTo", "missingPosition"));
(this.completionCallback = e),
(this.cancelled = !1),
(this.targetPosition = new f(t.latitude, t.longitude, t.altitude || this.wwd.navigator.range)),
(this.startPosition = new f(this.wwd.navigator.lookAtLocation.latitude, this.wwd.navigator.lookAtLocation.longitude, this.wwd.navigator.range)),
(this.startTime = Date.now());
var i,
r = this.travelTime,
n = c.greatCircleDistance(this.startPosition, this.targetPosition),
o = this.wwd.globe.computePointFromLocation(this.startPosition.latitude, this.startPosition.longitude, new p(0, 0, 0)),
s = this.wwd.globe.computePointFromLocation(this.targetPosition.latitude, this.targetPosition.longitude, new p(0, 0, 0));
this.maxAltitude = o.distanceTo(s);
var a = (this.wwd.navigator.currentState().pixelSizeAtDistance(this.startPosition.altitude) * this.wwd.canvas.clientWidth) / this.wwd.globe.equatorialRadius;
n <= 2 * a && (this.maxAltitude = this.startPosition.altitude),
(this.maxAltitudeReachedTime = this.maxAltitude <= this.wwd.navigator.range ? Date.now() : null),
this.maxAltitude > this.startPosition.altitude
? ((i = Math.max(0, this.maxAltitude - this.startPosition.altitude)), (i += Math.abs(this.targetPosition.altitude - this.maxAltitude)))
: (i = Math.abs(this.targetPosition.altitude - this.startPosition.altitude));
var l = Math.max(n, i / this.wwd.globe.equatorialRadius);
if (0 !== l) {
l < 2 * a && (r = Math.min((l / a) * this.travelTime, this.travelTime)), (r = Math.max(1, r)), (this.panVelocity = n / r), (this.rangeVelocity = i / r);
var h = this,
u = function () {
h.cancelled ? h.completionCallback && h.completionCallback(h) : h.update() ? setTimeout(u, h.animationFrequency) : h.completionCallback && h.completionCallback(h);
};
setTimeout(u, this.animationFrequency);
}
$('#searchButton').css('color', '#000');
})
我用于测试的自定义行是“$('#searchButton').css('color', '#000');”。它工作正常,但它在地球自转的开始运行。我需要它在轮换结束后运行。
知道如何实现这一点吗?
提前谢谢你。
【问题讨论】:
-
可能很难帮助您缩小代码。
-
我已将文件解压缩...
标签: javascript jquery animation worldwind