From 389dd67030b09ab16895cd829359751ad0f04dee Mon Sep 17 00:00:00 2001 From: lxc <237024898@qq.com> Date: Wed, 21 Dec 2022 11:46:47 +0800 Subject: [PATCH] led --- lndexUASBUpdate.html | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/lndexUASBUpdate.html b/lndexUASBUpdate.html index 4d94388..8fb15da 100644 --- a/lndexUASBUpdate.html +++ b/lndexUASBUpdate.html @@ -567,46 +567,46 @@ let date = new Date(); let m = date.getSeconds(); player.updateLabel("", m); - + } - var canvasTexture + var canvasTexture // 创建LED电子屏幕 - function addLEDScreen() { - var canvas = document.createElement("canvas"); - canvas.width = 512; - canvas.height = 64; - var c = canvas.getContext('2d'); - // c.fillStyle = "#aaaaff"; - c.fillStyle = "#000000"; - c.fillRect(0, 0, 512, 64); - // 文字 - c.beginPath(); - c.translate(256, 32); - c.fillStyle = "#FF0000"; //文本填充颜色 - c.font = "bold 28px 宋体"; //字体样式设置 - c.textBaseline = "middle"; //文本与fillText定义的纵坐标 - c.textAlign = "center"; //文本居中(以fillText定义的横坐标) - c.fillText("欢迎领导访问指导!!!", 0, 0); - - var cubeGeometry = new THREE.BoxGeometry(512, 64, 5); - canvasTexture = new THREE.CanvasTexture(canvas); - canvasTexture.wrapS = THREE.RepeatWrapping; - var material = new THREE.MeshPhongMaterial({ - map: canvasTexture, // 设置纹理贴图 - }); - var cube = new THREE.Mesh(cubeGeometry, material); - cube.position.set(0.10, 0.56, -1.48); - cube.rotation.y += Math.PI; //-逆时针旋转,+顺时针 - cube.scale.set(0.006,0.006,0.01); - scene.add(cube); - player.addRefeshFunction(updatetext); - } - function updatetext() { - if (canvasTexture) { - canvasTexture.offset.x += 0.003; - } + function addLEDScreen() { + var canvas = document.createElement("canvas"); + canvas.width = 512; + canvas.height = 64; + var c = canvas.getContext('2d'); + // c.fillStyle = "#aaaaff"; + c.fillStyle = "#000000"; + c.fillRect(0, 0, 512, 64); + // 文字 + c.beginPath(); + c.translate(256, 32); + c.fillStyle = "#FF0000"; //文本填充颜色 + c.font = "bold 28px 宋体"; //字体样式设置 + c.textBaseline = "middle"; //文本与fillText定义的纵坐标 + c.textAlign = "center"; //文本居中(以fillText定义的横坐标) + c.fillText("欢迎领导访问指导!!!", 0, 0); + + var cubeGeometry = new THREE.BoxGeometry(512, 64, 5); + canvasTexture = new THREE.CanvasTexture(canvas); + canvasTexture.wrapS = THREE.RepeatWrapping; + var material = new THREE.MeshPhongMaterial({ + map: canvasTexture, // 设置纹理贴图 + }); + var cube = new THREE.Mesh(cubeGeometry, material); + cube.position.set(0.10, 0.56, -1.48); + cube.rotation.y += Math.PI; //-逆时针旋转,+顺时针 + cube.scale.set(0.006, 0.006, 0.01); + scene.add(cube); + player.addRefeshFunction(updatetext); + } + function updatetext() { + if (canvasTexture) { + canvasTexture.offset.x += 0.003; } + }