I use css3DSprite in my project, it works on the pc but not on iOS。 my three.js version is 151 ,ios version is 14.1
Code:
`initScene() {
let container = document.getElementById(“container”)
this.width = container.offsetWidth
this.height = container.offsetHeight
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(45, this.width / this.height, 1, 1000);
this.scene.add(this.camera);
this.camera.position.set(0, 30, 50)
//this.setting.this.scene.antialias
this.renderer = new THREE.WebGLRenderer({alpha: true, antialias: antialias: false, logarithmicDepthBuffer: false});
this.renderer.outputEncoding = THREE.sRGBEncoding;
this.renderer.setSize(this.width, this.height);
// this.renderer.setPixelRatio(window.devicePixelRatio);
container.appendChild(this.renderer.domElement)
this.labelRenderer = new CSS3DRenderer();
this.labelRenderer.setSize(this.width, this.height);
this.labelRenderer.domElement.style.position = 'absolute';
this.labelRenderer.domElement.style.top = 0;
this.labelRenderer.domElement.style.pointerEvents = 'none';
container.appendChild(this.labelRenderer.domElement)
},`
loadNameSprite(character, username, color) {
var div = document.createElement('div');
div.className = 'label_name';
div.style.color = color
div.textContent = username;
var sprite = new CSS3DSprite(div);
sprite.name = 'username'
sprite.scale.set(0.01, 0.01, 0.01)
character.add(sprite)
sprite.position.set(0, 2, 0)
},
animate() {
this.renderer.render(this.scene, this.camera);
this.labelRenderer.render(this.scene, this.camera)
requestAnimationFrame(this.animate);
}
Screenshots
the screenshot is on the ios
the screenshot is on the pc (window)