There are only a handful of 3D visualization platforms that seem to be doing well. If you don’t use Threejs, it’s true that Threejs is the originator of 3D development, but it requires a lot of developers to do it. Thingjs is a threejs package that allows you to quickly develop with fast code, code frameworks, as long as the front-end engineers know JAVASCRIPT. Just know webGL. I suggest you have a try
/ * *
* Description: Use pictures as background to draw in canvas to simulate the application scenario of indicator panel
* Action: Click the button
* Difficulty: ★★★★☆
* /
var app = new THING.App({
Url: ‘https://www.thingjs.com/static/models/storehouse’/address/scene
});
/ / timer
var timer;
app.on(‘load’, function () {
// Set the camera position and target point
App.camera. Position = [24.036125586913663, 2.654545333744903, 15.118547603300897];
App. Camera. Target = [18.887027584951163, 1.4664667942992755, 2.077588743688154];
Button(‘ canvas +canvas ‘, function () {new thing.widget. Button(‘ canvas +canvas ‘, function () {
var plane = app.query(‘#myPlane01’)[0];
if (plane) return;
var car = app.query(‘car01’)[0];
var imgUrl = ‘https://www.thingjs.com/static/images/monitorPanel3.png’;
var imgWidth = 512;
var imgHeight = 329;
var img = new Image(imgWidth, imgHeight);
img.crossOrigin = “Anonymous”;
img.src = imgUrl;
img.onload = function () {
var canvas = createCanvas({ image: img, text: 10, imgWidth, imgHeight });
var newImg = new Image(canvas.width, canvas.height);
newImg.src = canvas.toDataURL(“image/png”);
var plane = app.create({
type: ‘Plane’,
id: ‘myPlane01’,
Width: imgWidth * 0.004,
Height: imgHeight * 0.004,
parent: car,
localPosition: [0, 3, 0],
style: {
image: newImg,
Opacity: 0.9,
color: ‘#ffffff’
}
});
// Store the original image for redrawing
plane[‘origialImg’] = img;
// Store canvas for redrawing
plane[‘myCanvas’] = canvas;
};
})
Function () {new thing.widget. Button(‘ Button ‘, function () {
var plane = app.query(‘#myPlane01’)[0];
if (plane) {
updateImage(plane)
}
});
New thing.widget. Button(‘ stop update ‘, function () {
if (timer) {
clearInterval(timer);
timer = null;
}
})
})
function createCanvas(param) {
var canvas = param.canvas;
var image = param.image;
var text = param.text;
if (! param.canvas) {
canvas = document.createElement(“canvas”);
canvas.width = param.imgWidth;
canvas.height = param.imgHeight;
}
var ctx = canvas.getContext(“2d”);
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(image, 0, 0);
ctx.fillStyle = “rgb(255, 255, 255)”;
ctx.font = “80px sans-serif”;
ctx.textBaseline = “middle”;
Ctx. fillText(‘ temp: ‘, 50, canvas.height / 2);
ctx.fillText(text, 270, canvas.height / 2);
Ctx.filltext (‘℃’, 380, canvas.height / 2);
return canvas;
}
function updateImage(plane) {
if (! timer) {
timer = setInterval(() => {
var canvas = createCanvas({ image: plane[‘origialImg’], text: THING.Math.randomInt(0, 38), canvas: plane.myCanvas });
var newImg = new Image(canvas.width, canvas.height);
newImg.src = canvas.toDataURL(“image/png”);
plane.style.image = newImg;
}, 1000).
}
}