The Tri-dimensional.js StereoEffect

I'm unsure why it isn't functioning properly. I've included:

var effect = new THREE.StereoEffect(renderer);
effect.eyeSeparation = 10; 
effect.setSize(window.innerWidth, window.innerHeight);
console.log("aspect ratio is " + window.innerWidth /window.innerHeight);

and in the animate function:

effect.render(scene, camera);

You can view an example on codepen here.

Answer №1

After exploring a different example, I was able to solve my issue with the following outcome:

I made some modifications to the code by adding:

var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;

To see the final result, visit my codepen demo.

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

The method piSession.buildPageInteractionSession is not valid

Hey there! I am facing an issue with a simple AJAX call to a PHP file. The request should be sent to the server and return back in an HTML input field. Unfortunately, I have not been able to resolve this error so far. Below is the code snippet: HTML: ...

Would it be beneficial to upload and download an image using the same ajax call?

I recently made a change to my web app's image upload feature. Previously, the process involved uploading an image, retrieving the image URL, and then making a second request to download the image from the URL. Now, I have streamlined it so that when ...

What is the best way to ensure that the operations are not completed until they finish their work using RX

Is there a way to make RXJS wait until it finishes its work? Here is the function I am using: getLastOrderBeta() { return this.db.list(`Ring/${localStorage.getItem('localstorage')}`, { query: { equalTo: fa ...

Guide on performing an inner-join query in Firestore using NextJS

My Firestore database contains two collections that I need to work with. The 'uid' field in the users collection and the 'createdBy' field in the 'anuncios' collection both store the same string data, linking each 'anunc ...

Troubleshooting AngularJS: Issues with dividing by scope variable

I am using angular-timer. This particular code snippet works fine: {{ (seconds / 10) * 100 }} But when I try this one, it doesn't work as expected: {{ (seconds / secondsToAnswer ) * 100 } (it gives NaN as the result) Even though I have defined s ...

Tips for populating input fields with retrieved data when the fields are generated dynamically

Sharing some context: I've been working on implementing an edit button for a Content Management System, facing a few challenges along the way. I've taken over from another developer who initiated the CMS project, and I'm now tasked with com ...

The form is refusing to submit even after using the "return false

Even after adding validation to the form, it still submits when the script returns false. The Form Submission <form action=payment.php method=POST name=UserForm id=UserForm onsubmit="return check(this); return false;"> Javascript Code function ch ...

5 Creative Techniques for Manipulating Boolean Variables in If Statements

I am receiving a unique custom header value and the values I am getting are accurate. The expected values include: true, false, undefined. However, the response associated with the value: false is incorrect. Code Snippet let deviceStatus = req.headers[ ...

Looking to update the elements within a KnockoutJS observable array

In my code, I have a knockoutJS observable array that was created in the typical way: var MyGridModel = function(items) { var self = this; this.items = ko.observableArray(items); ... Now, I want to update this array with new data. My goal here is to comp ...

Obtaining the clientID when the textbox name is stored in a string variable

I am struggling with the following code intended to check for a blank value in my textbox, but it is resulting in a compilation error. Can someone help me find a solution? Here is my code in JavaScript: function checkTextboxNotFilled(txtbox) { v ...

Encountering a 500 error while attempting to send data to an API route within a Laravel web page using XMLHttpRequest at http://127:8000/api/v1/exemp. Can anyone

let requestData = { products: [ { description: "product1", barcode: "123456", price: 10, note: "note1" }, { description: "product2", barcode: "654321", price: 20, note: "note2" ...

To utilize a spread argument, it is essential for it to either be in tuple form or be supplied to a rest

I am currently learning TypeScript and working on converting my project to TypeScript. However, I encountered an error while trying to use spread arguments. I have researched this topic, but I am still unsure of the correct usage. Here is my current appro ...

populate the empty slots in an array with the correct numbers

Having two pre-sorted arrays as shown below: [1,2,4,5,8] [x,x,x,x,x] The goal is to fill in the missing elements with 'y' in the corresponding array, resulting in: [1,2,3,4,5,6,7,8] [x,x,y,x,x,y,y,x] Although the data arrives separately, they ...

Utilize jQuery/AJAX to extract a specific value from JSON data and transform it into a different value within the same

Hello everyone, I've been coding all day to try and solve this issue but my code doesn't seem to be working. Can anyone help me with this problem? I'm trying to convert selected JSON data into a different value. Let's take an example: ...

Attitude: Defiant and Ignoring Authority

So far, no suggestions have been made, indicating that maybe I haven't properly summarized the issue; The problem arises when I absolutely position the section with the class="container" using an additional class or id specific to that <div>. I ...

Three.js - demonstrating the play of light and shadows across various perspectives

This particular example showcasing multiple views involves a complex implementation of shadows, rather than opting for the simpler method of just setting an object's property castShadow = true. Is it impossible to use the straightforward approach for ...

How can AngularJS utilize variables from an external JavaScript <script> file within an HTML document?

As someone unfamiliar with AngularJS, I have a simple inquiry regarding the subject. The code on my page begins by defining an app and controller: <script> var isisApp = angular.module('isisApp', []); isisApp.controller('Acco ...

Unlocking the contents of an array from a separate file in Next.js

I am developing a Quiz App that consists of two main pages: takeQuiz.js and result.js. My goal is to transfer the data from the multiple-choice questions (mcqs) in takeQuiz.js to be accessible in result.js. Utilizing router.replace(), I ensure that once th ...

Changing a datetime string into a specific unit of time (such as seconds) using Javascript

Struggling with converting a Rails timestamp into a usable format for JavaScript. When alerting the time of an event, the string produced is: 2016-02-18T23:07:00.000-08:00. It doesn't appear to be a UTC string, according to this resource, and I' ...

decipher the string using various operators

Is it possible to explode a string using different operators? I am trying to extract every code (of varying sizes) between the brackets [ and ] Here are some examples of the different possibilities: const codes = [ '[5018902847][592][50189272809] ...