Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

348
Visualizações
Black screen using Three.js with ionic 6 and angular

I want to make a 3d configurator of a product, i already wrote the app in ionic using the angular framework, now i have to make the configurator using three.js.

I tried this to test three.js inside a page, but it does not work, all i can see is a black screen while it should display this.

This is the code i wrote for the page:

<ion-header>
  <ion-toolbar style="--ion-toolbar-background: #ee7554; --border-style: ios">
    <ion-buttons slot="start">
      <ion-back-button color=dark text="Indietro" icon="chevron-back-outline"></ion-back-button>
    </ion-buttons>
    <ion-title>Configuratore threejs</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <script src="https://threejs.org/build/three.js"></script>
  <script>
    var scene = new THREE.Scene();
    var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);

    var renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    var geometry = new THREE.BoxGeometry(1, 1, 1);
    var material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
    var cube = new THREE.Mesh(geometry, material);
    scene.add(cube);

    camera.position.z = 5;

    var animate = function () {
      requestAnimationFrame(animate);

      cube.rotation.x += 0.01;
      cube.rotation.y += 0.01;

      renderer.render(scene, camera);
    };

    animate();
  </script>
</ion-content>

and in the CSS sheet i wrote this:

body { margin: 0; }
canvas { width: 70%; height: 100% }

Could angular-three be useful in this project?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda