How to remove controls and zoom in using Three.js

Looking for solutions to the following issues:

1- How can I remove the controls panel located at the top right corner (behind stroke but still visible) on this page

2- Want to zoom in (possibly by moving the camera) a bit and then enhance the visibility of the words displayed as a background on this page . Which parameters in my code should be adjusted to achieve this?

My code snippet:


        
            import * as THREE from '../../build/three.module.js';

            import Stats from '../../jsm/libs/stats.module.js';

            import { GUI } from '../../jsm/libs/dat.gui.module.js';

            // More code continues...

Answer №1

Currently, I can provide a partial solution;

  1. I'm unsure of your query, please elaborate.

  2. Your camera is presently controlled by the mouse's position on the page.

         function onPointerMove( event ) {
             if ( event.isPrimary === false ) return;
             mouseX = event.clientX - windowHalfX;
             mouseY = event.clientY - windowHalfY;
         }
    

The provided code processes the movement event and stores the x/y positions

When rendering your scene here

        function render() {
            // Scene camera position is altered based on cursor position giving 'control' effect
            camera.position.x += ( mouseX - camera.position.x ) * 0.05;
            camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
            
             ..........
          
            renderer.render( scene, camera );
        }

If you wish to add zoom functionality, it can be done easily! PerspectiveCamera has native support for zooming:

Simply detect mouse wheel changes (or pinches on mobile) and adjust zoom during rendering!

Mousewheel event in modern browsers

Alternatively; You can discard this code and utilize one of Threejs' built-in control libraries like OrbitControls or FlyControls

EDIT: In response to a comment:

To globally increase text size, modify the size attribute in your material

                material2 = new THREE.PointsMaterial( { size: 35, sizeAttenuation: true, map: sprite2, alphaTest: 0.5, transparent: true } );

Threejs provides comprehensive documentation, consider exploring it to understand common parameters!

Moreover, adding zoom capability to the camera allows you to navigate through the depth of the words, enhancing the visual appeal, but the choice depends on your objective.

If my responses have been helpful, please consider marking my answer as "accepted" - Best of luck!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can you explain the distinction between using `yarn link` versus `npm link`?

There have been instances where npm link seemed to work better than yarn link which resulted in strange errors. This discrepancy caught my attention a few times. I was under the impression that both commands were essentially creating symbolic links, but ...

The issue of Angular JQuery Datepicker failing to set the MinDate upon initialization

In my AngularJS project, I am using JQuery UI's Datepicker for the Date From and Date To fields. I have successfully bound the value to the model using a directive, and I have also implemented logic in the OnSelect function to ensure that the Date To ...

javascript utilizing key inputs

Is there a way I can create a function that activates when the "A" key on my keyboard is pressed, sending a signal to nupp('/TS'), and stops sending the signal when the "A" key is released? <html> <head> <script src=\"htt ...

Struggles with handling asynchronous events in Angular

I'm currently working on a piece of code that iterates through an array containing 10 items. For each item, a request is made and the returned data is stored in another array. The entire process goes smoothly until reaching the line that contains $q.a ...

Creating Typescript libraries with bidirectional peer dependencies: A complete guide

One of my libraries is responsible for handling requests, while the other takes care of logging. Both libraries need configuration input from the client, and they are always used together. The request library makes calls to the logging library in various ...

Intelligent Scrolling with Bootstrap 4

Utilizing a basic tutorial from here to implement show/hide functionality for a standard BS4 navbar on scroll. Works flawlessly on desktop. However, facing an issue with the mobile view where the navbar behaves oddly when scrolling down and returning to t ...

What is the best way to incorporate dynamic HTML content into the designated section?

I have the concept of including a text box in each dynamically created div. HTML <!DOCTYPE html> <html> <head> <title>trial </title> <meta charset="utf-8"> <meta name="viewport" cont ...

Ways to align the label at the center of an MUI Textfield

My goal is to center the label and helper text in the middle of the Textfield. I managed to achieve this by adding padding to MuiInputLabel-root, but it's not responsive on different screen sizes (the Textfield changes size and the label loses its cen ...

Unable to function properly on Backbone.js, events have been rendered ineffective

I have recently created a view with the following code snippets: var app = app || {}; app.singleFlowerView = Backbone.View.extend({ tagName: 'article', className: 'flowerListItem', // specifies where to render the views templ ...

Exploring a personalized approach to searching in DataTables

I am facing a dilemma with implementing a custom search in a DataTables table due to my limited experience with JavaScript. The function I have only triggers on startup and not when typing in the search box. If you're interested, you can find my orig ...

Recursive routing in NodeJS using Express

Certain website APIs have the capability to perform actions such as: Initial user's id their first friend, also a user v v GET /api/users/54282/friends/0/friends/0 ...

Complex recurrent operation

Can anyone assist me in solving this complex loop? I need to call 5 API URLs, each a specific number of times before moving on to the next URL in sequence and then starting over again. https://www.example1.com should be called 4 times https://www.example2 ...

Move to the following array when clicking PHP (using Ajax, perhaps?)

How can I trigger php code when a button is clicked? (I understand the distinction between client-side and server-side. However, I believe I have encountered a similar scenario before.) Consider the following array : $test_id = [ 1 => '15 ...

Sending both an array and an image via Ajax in a single request

I need to send both JSON and file data to my PHP backend using an ajax call. Here is my current ajax call: $.ajax({ type: 'POST', dataType: 'json', data: jsonData, url: 'xxx.php', cache: false, suc ...

Dispatch is successful half of the time in children when looping within useEffect

Recently, I embarked on the journey of learning React. However, I encountered a problem when using dispatch in UseEffect, which is nested inside a child component loop. While I cannot share the entire project, here is a snippet of the code: The home page ...

Enhance your website with the jQuery autocomplete feature, complete with

Is there a way to incorporate smaller text descriptions alongside the search results displayed on my website? The descriptions are available in the data array used by autocomplete and can be accessed using the .result function by calling item.description. ...

Unable to persist cookies while utilizing npm's request library

I'm currently working on setting up a local environment where I'm attempting to log into a service. In the client side, I'm using the 'request' library, and on the service side, I'm utilizing Express and express-session. Whil ...

I'm encountering inexplicable duplications of elements on my Wordpress site

Here is an example of my template header: <header> <?php if ( function_exists( 'jetpack_the_site_logo' ) ) jetpack_the_site_logo(); ?> <a class="menu-toggle">menu</div> <?php wp_nav_menu( array('them ...

"Interactive Connect 4 Game in Javascript - Drop the disk into the bottom row of the chosen

Check out this awesome Connect4 game I found: http://codepen.io/anon/pen/lmFJf I have a specific goal in mind for the game. When I click on an empty space in any column, I want it to automatically drop into the lowest available spot in that column, follow ...

"Combining multiple DIVs into a single DIV with jQuery - a step-by-step guide

I have multiple DIVs with the same class, and I am looking to group them into a single DIV using either jQuery or pure JS. <div class="a"> <div>1</div> </div> <div class="a"> <div>2</div> ...