【问题标题】:How to change globe color black to white using gio js如何使用 gio js 将地球颜色从黑色变为白色
【发布时间】:2020-05-08 08:34:47
【问题描述】:

我找到了一些更改颜色的链接,但没有用:Change the color of a Three.js globe 我需要使用 http://gio.js 将地球的颜色从黑色更改为白色

我尝试了以下代码来改变颜色,但无法产生预期的结果:

var container = document.getElementById("globalArea");
    var configs = {
        "control": {
            "stats": false,
            "disableUnmentioned": false,
            "lightenMentioned": true,
            "inOnly": false,
            "outOnly": false,
            "initCountry": "PK,CN",
            "halo": true,
            "transparentBackground": true,
            "autoRotation": false,
            "rotationRatio": 0

        },
        "color": {
            "surface": 10334380,
            "selected": 14853451,
            "in": 11247212,
            "out": 14823329,
            "halo": 9539985,
        },
        "brightness": {
            "ocean": 0,
            "mentioned": 0,
            "related": 0
        }

    };
    var controller = new GIO.Controller(container, configs);

    console.log(controller);
    //controller.setHaloColor("#7E8084");
    controller.removeHalo();
    controller.setTransparentBackground(true);
    controller.setInitCountry("BE");
    controller.lightenMentioned(true);
    controller.adjustOceanBrightness(0.8);
    controller.setSurfaceColor("#FFFFFF");
    controller.adjustRelatedBrightness(0.8);
    controller.adjustMentionedBrightness(0.8);
    //controller.addData(data);
    controller.init();

【问题讨论】:

    标签: javascript jquery html css three.js


    【解决方案1】:
     function init() {
        var $ = go.GraphObject.make;
    
        myDiagram =
          $(go.Diagram, "myDiagramDiv",
              {
                initialContentAlignment: go.Spot.Center  // for v1.*
              });
    
        myDiagram.nodeTemplate =
          $(go.Node, "Auto",
            $(go.Shape,
              { fill: "darkslategray", portId: "" },
              new go.Binding("fill", "isHighlighted", function(h) { return h ? "red" : "darkslategray"; }).ofObject()),
            $(go.TextBlock,
              { margin: 8, stroke: "white" },
              new go.Binding("text"))
          );
    
        myDiagram.linkTemplate =
          $(go.Link,
            {
              click: function(e, link) {
                e.diagram.commit(function(diag) {
                  diag.clearHighlighteds();
                  link.toNode.isHighlighted = true;
                }, "highlight toNode")
              }
            },
            $(go.Shape),
            $(go.Shape, { toArrow: "OpenTriangle" })
          );
    
        myDiagram.model = new go.GraphLinksModel(
        [
          { key: 1, text: "Alpha" },
          { key: 2, text: "Beta" },
          { key: 3, text: "Gamma" }
        ],
        [
          { from: 1, to: 2 },
          { from: 1, to: 3 }
        ]);
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-28
      • 2011-05-06
      • 1970-01-01
      • 1970-01-01
      • 2013-01-13
      • 1970-01-01
      相关资源
      最近更新 更多