1

Im working on a 3D Canvas using p5.js and three.js.

My question is: How to set the image on the corner of the 3D canvas? Notice that when i work on the canvas i don't want the image to disappear but also not move, as I might rotate or move around in the scene.

The link below shows the problem. Basically i want the "reset_Camera" image on the corner of the 3D scene. Need to move image at canva's corner!

I tried using Three.SpriteText but didn't work for me.

HTML & CSS

<input type="image" src="images/resetCameraIcon.png"/>

<canvas width="960" height="528" style="width: 960px; height: 528.545px;
display: block; padding-left: 0px; padding-right: 0px; margin-left: auto;
margin-right: auto; margin-top: 20px;"></canvas>

Javascript:

//Add new Camera
canvas_Camera = new THREE.PerspectiveCamera(90, window.innerWidth / window.innerHeight, 0.01, 10000);
canvas_Camera.position.set( 2, 0.8, 2); //Set camera position

//Add new Scene
canvas_Scene = new THREE.Scene();

//Add new Renderer
canvas_Renderer = new THREE.WebGLRenderer({ antialias: true });
canvas_Renderer.setSize(canvasWidth, canvasHeight); //Set Renderer Size

//Assign 3D Space to canvas
canvas_Element = canvas_Renderer.domElement;

//Add CSS Styles on Canvas
...lines

//Add Canvas to index.html
canvas_Parent.appendChild(canvas_Element);
Loizos Vasileiou
  • 674
  • 10
  • 37

0 Answers0