lxc 2 years ago
parent
commit
389dd67030
  1. 72
      lndexUASBUpdate.html

72
lndexUASBUpdate.html

@ -567,46 +567,46 @@
let date = new Date(); let date = new Date();
let m = date.getSeconds(); let m = date.getSeconds();
player.updateLabel("", m); player.updateLabel("", m);
} }
var canvasTexture var canvasTexture
// 创建LED电子屏幕 // 创建LED电子屏幕
function addLEDScreen() { function addLEDScreen() {
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
canvas.width = 512; canvas.width = 512;
canvas.height = 64; canvas.height = 64;
var c = canvas.getContext('2d'); var c = canvas.getContext('2d');
// c.fillStyle = "#aaaaff"; // c.fillStyle = "#aaaaff";
c.fillStyle = "#000000"; c.fillStyle = "#000000";
c.fillRect(0, 0, 512, 64); c.fillRect(0, 0, 512, 64);
// 文字 // 文字
c.beginPath(); c.beginPath();
c.translate(256, 32); c.translate(256, 32);
c.fillStyle = "#FF0000"; //文本填充颜色 c.fillStyle = "#FF0000"; //文本填充颜色
c.font = "bold 28px 宋体"; //字体样式设置 c.font = "bold 28px 宋体"; //字体样式设置
c.textBaseline = "middle"; //文本与fillText定义的纵坐标 c.textBaseline = "middle"; //文本与fillText定义的纵坐标
c.textAlign = "center"; //文本居中(以fillText定义的横坐标) c.textAlign = "center"; //文本居中(以fillText定义的横坐标)
c.fillText("欢迎领导访问指导!!!", 0, 0); c.fillText("欢迎领导访问指导!!!", 0, 0);
var cubeGeometry = new THREE.BoxGeometry(512, 64, 5); var cubeGeometry = new THREE.BoxGeometry(512, 64, 5);
canvasTexture = new THREE.CanvasTexture(canvas); canvasTexture = new THREE.CanvasTexture(canvas);
canvasTexture.wrapS = THREE.RepeatWrapping; canvasTexture.wrapS = THREE.RepeatWrapping;
var material = new THREE.MeshPhongMaterial({ var material = new THREE.MeshPhongMaterial({
map: canvasTexture, // 设置纹理贴图 map: canvasTexture, // 设置纹理贴图
}); });
var cube = new THREE.Mesh(cubeGeometry, material); var cube = new THREE.Mesh(cubeGeometry, material);
cube.position.set(0.10, 0.56, -1.48); cube.position.set(0.10, 0.56, -1.48);
cube.rotation.y += Math.PI; //-逆时针旋转,+顺时针 cube.rotation.y += Math.PI; //-逆时针旋转,+顺时针
cube.scale.set(0.006,0.006,0.01); cube.scale.set(0.006, 0.006, 0.01);
scene.add(cube); scene.add(cube);
player.addRefeshFunction(updatetext); player.addRefeshFunction(updatetext);
} }
function updatetext() { function updatetext() {
if (canvasTexture) { if (canvasTexture) {
canvasTexture.offset.x += 0.003; canvasTexture.offset.x += 0.003;
}
} }
}
</script> </script>

Loading…
Cancel
Save