首页 > 大数据 > 可视化 > 从零开始学习3D可视化之3D界面
app.create({
type: "Marker",
offset: [0, 2, 0],
size: [4, 4],
url: "https://thingjs.com/static/images/warning1.png",
parent: app.query("car01")[0]
});

function createTextCanvas(text, canvas) {
if (!canvas) {
canvas = document.createElement("canvas");
canvas.width = 64;
canvas.height = 64;
}
const ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(32, 32, 256)";
ctx.beginPath();
ctx.arc(32, 32, 30, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = "rgb(255, 255, 255)";
ctx.lineWidth = 4;
ctx.beginPath();
ctx.arc(32, 32, 30, 0, Math.PI * 2);
ctx.stroke();
ctx.fillStyle = "rgb(255, 255, 255)";
ctx.font = "32px sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 32, 32);
return canvas;
}
app.on('load', function (ev) {
var marker = app.create({
type: "Marker",
offset: [0, 2, 0],
size: 3,
canvas: createTextCanvas('100'),
parent: app.query('car02')[0]
}).on('click', function (ev) {
var txt = Math.floor(Math.random() * 100);
ev.object.canvas = createTextCanvas(txt, ev.object.canvas)
})
})

var webView01 = app.create({
type: 'WebView',
url: 'https://www.thingjs.com',
position: [10, 13, -5],
width: 1920 * 0.01,
height: 1080 * 0.01,
domWidth: 1920,
domHeight: 1080
});

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69980539/viewspace-2781600/ ,如需转载,请注明出处,否则将追究法律责任。