gpt4 book ai didi

javascript - 如何使用 gio js 将地球颜色从黑色更改为白色

转载 作者:行者123 更新时间:2023-11-28 03:13:39 28 4
gpt4 key购买 nike

我找到了一些更改颜色的链接,但它不起作用: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();

最佳答案

 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 }
]);
}

关于javascript - 如何使用 gio js 将地球颜色从黑色更改为白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59855388/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com