我想在babylon.js 場景后面顯示文本。我已經將背景設為透明,但看不到其后面的文字。我還嘗試過 z-index:-1 作為文本。我從昨晚才開始學習巴比倫,所以我真的不太清楚發生了什么。我也不擅長 java 腳本,所以任何幫助將不勝感激:) \\\\\<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>BBY TIAL </title> <script src="https://cdn.babylonjs.com/babylon.max.js"></script> <style> *{ background-color: pink; } #canvas { width:80%; height:80vh; z-index:10; border:0; padding:0; margin:0; background-color: transparent; } #maya{ font-size: 300px; color:white; position: absolute;; background-color: transparent; z-index:-200; } #wright{ font-size: 300px; color:white; position: fixed; z-index:1; top:50vh; left:40%; background-color: transparent; } #full{ z-index: -9; } </style></head><body> <h1 id="maya">MAYA</h1> <h2 id="wright">WRIGHT</h2><canvas id="canvas"></canvas><script> window.addEventListener('DOMContentLoaded', function(){ var canvas = document.getElementById('canvas'); var engine = new BABYLON.Engine(canvas, true,); engine.enableOfflineSupport = false; // Dont require a manifest file var createScene = function(){ var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color4(0, 0, 0, 0); var camera = new BABYLON.ArcRotateCamera("arcCam", BABYLON.Tools.ToRadians(0), BABYLON.Tools.ToRadians(0), 7.,BABYLON.Vector3.Zero(),scene); camera.attachControl(canvas,true); var light = new BABYLON.PointLight("PointLight",new BABYLON.Vector3( 5,5,5),scene); light.parent = camera; light.intensity = 1000.5;
具有透明背景的babylon.js場景不會顯示其z-index后面的圖像/文本
慕婉清6462132
2023-11-13 10:48:33