以在繪制地球儀后動態添加位置/點和紅線。(本質上,我想動態添加數據,而不是像示例那樣從一組固定的點開始)。繪制紅色虛線,但隨著地球旋轉,這些線保持在相同位置。如何讓我的線條像示例中那樣隨地球旋轉?我的小提琴: https:?//jsfiddle.net/6qhvt8aL/2/? var width = 960,? ? height = 500;? var proj = d3.geoOrthographic().scale(230).translate([width / 2, height / 2]).clipAngle(90);? var path = d3.geoPath().projection(proj).pointRadius(1.5);? var graticule = d3.geoGraticule();? var london = [-0.118667702475932, 51.5019405883275];? var time = Date.now();? var rotate = [39.666666666666664, -30];? var velocity = [.015, -0];? var lineToLondon = function(d) {? ? return path({? ? ? "type": "LineString",? ? ? "coordinates": [london, d.geometry.coordinates]? ? });? }? function stripWhitespace(str) {? ? if (!str) {? ? ? return "";? ? }? ? return str.replace(" ", "");? }? var svg = d3.select("body").append("svg").attr("width", width).attr("height", height)? svg.call(d3.drag().on("start", dragstarted).on("drag", dragged));? queue().defer(d3.json, "https://openlayers.org/en/latest/examples/data/topojson/world-110m.json").defer(d3.json, "/static/destinations.json").await(ready);? var places = {? ? "type": "FeatureCollection",? ? "features": [{? ? ? "type": "Feature",? ? ? "properties": {? ? ? ? "name": "San Francisco"? ? ? },? ? ? "geometry": {? ? ? ? "type": "Point",? ? ? ? "coordinates": [-122.417168773552248, 37.769195629687431]? ? ? }? ? }, {? ? ? "type": "Feature",? ? ? "properties": {? ? ? ? "name": "Chicago"? ? ? },? ? ? "geometry": {? ? ? ? "type": "Point",? ? ? ? "coordinates": [-87.752000832709314, 41.831936519278429]? ? ? }? ? }, {? ? ? "type": "Feature",? ? ? "properties": {? ? ? ? "name": "Los Angeles"? ? ? },? ? ? "geometry": {? ? ? ? "type": "Point",? ? ? ? "coordinates": [-118.243683, 34.052235]? ? ? }? ? }
如何讓我的線條與地球一起旋轉?
慕俠2389804
2023-07-20 17:28:36