Experience the beauty of having multiple Three.js CSS3D scenes displayed on a single HTML page with the captivating molecules

After studying a remarkable example by Mr. Doob found at http://threejs.org/examples/css3d_molecules.html, my goal is to develop a webpage presenting TWO 3D chemical structures side by side:

I am facing challenges with the structure on the right half. Both halves are represented as <div> elements with corresponding id's containerleft and containerright, each sporting unattractive background colors :). Despite my attempt to duplicate all variables and associate them with individual containers, I have not been successful.

Although I came across a three.js demonstration showcasing multiple views using WebGL, unfortunately, I cannot utilize WebGL in this scenario.

This code snippet provided below is an abridged version derived from examples/css3d_molecules.html located at https://github.com/mrdoob/three.js.

    <div id="containerleft"></div>
    <div id="containerright"></div>

    <!-- *** 3D MOLECULE *** -->        
    <script src="../../../www/js/three/three.min.js"></script>
    <script src="../../../www/js/three/TrackballControls.js"></script>
    <script src="../../../www/js/three/CSS3DRenderer.js"></script>
    <script src="../../../www/js/three/PDBLoader.js"></script>
    ...
</script>

Thank you!

Answer №1

After experimenting with the CSS3DRenderer, it seems like duplicating the entire code is currently the only method to achieve the desired result.

I am in the process of developing an interactive stereo viewer specifically for iPad (similar to projects created by some other students, but in HTML format), and in order to accomplish this, I require two identical images with a slight variation in camera positioning. While there are existing libraries available for achieving this using the WebGL renderer, it appears that CSS3 still has limitations that prevent us from replicating the same effect.

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

What is the best way to use async await to listen for an event in a child component with Vue-router?

To prevent users from unintentionally leaving an unsaved form, I am looking to implement a custom modal alert system with vue-router. Although the use of the standard browser alert box is an option, beforeRouteLeave (to, from, next) { const answer = wi ...

The Angular datepicker is failing to trigger the ng-change event

I've run into a snag with the datepicker and ng-change functionality. Oddly enough, the ng-change event isn't triggering when I manually select a date by clicking on it, but it works fine when I input a date manually. Take a look at my code snip ...

I have image paths stored in my mySQL Database, how can I showcase them on my website?

As a beginner, I'm embarking on a learning journey where my aim is to showcase images from my database alongside other content within the same row in my HTML. Below is the JavaScript code snippet from my HTML file: <script type="text/javascri ...

What is the best way to ensure the menu background aligns perfectly with the header in HTML/CSS?

Issue: Menu background doesn't align with header. (visible in the image provided below) VIEW IMAGE Any suggestions on how to resolve this alignment problem? CSS CODE : .header { margin:0px auto; max-width: 960px; } #header { height:30 ...

What is the best way to retrieve the column that comes after a specific column?

I have a specific column and I want to extract the subsequent column in the dataset. nhood,column,variablecolumn Treasure Island,3,5 McLaren Park,1,2 Tenderloin,28,112 Lakeshore,14,8 Chinatown,15,103 Although I know the name of the second column, the na ...

Can you employ a right-side offset in Bootstrap 4?

Is it possible to align a button with a textbox using the Bootstrap 4 layout system? https://i.sstatic.net/tN9II.png <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/> <div ...

The method of pausing a function until the result of another function is returned

There is a function named 'updateProfile()' that includes a condition, which checks for the value of variable 'emailChangeConfirm' obtained from another function called 'updateEmailAllProcessing()'. The issue lies in the fact ...

Is there a way in JavaScript to convert comma-separated values into an array?

I currently have a code that makes combo boxes hide or show, but I am concerned about what will happen if I add more categories. If I do add more categories, I would have to modify the code each time. My goal is to have a variable that can hold multiple v ...

Webpack does not support d3-tip in its current configuration

I'm having some trouble getting d3-tip to work with webpack while using TypeScript. Whenever I try to trigger mouseover events, I get an error saying "Uncaught TypeError: Cannot read property 'target' of null". This issue arises because th ...

Having trouble with Angular's ng-tags-input? Are you getting the error message "angular is not defined"? Let

I recently created a new Angular project using the following command: ng new "app-name" Now, I'm attempting to incorporate ngTagsInput for a tag input feature. However, every time I try to build and run my app, I encounter an error in my browser con ...

Limit the random color generator function to only produce a predetermined color in JavaScript

By utilizing the following function, I am able to create random colors: function getRandomColor() { var letters = '0123456789ABCDEF'.split(''); var color = '#'; for (var i = 0; i < 6; i++) { color += le ...

The Conundrum of CSS versus Razor Views

Currently, I am developing a basic website using ASP.NET/MVC with Razor (.cshtml). As I am relatively new to CSS, I am interested in customizing the appearance and style of my site. After inspecting the source of the homepage, I find myself struggling to t ...

Automatically scrolling down a div as new content is added using XMLHTTPRequest.openConnection

https://jsfiddle.net/kv5gbamg/ - I created a jsfiddle to demonstrate the functionality of the system Essentially, I am seeking a way to automatically scroll the scrollbar to the bottom every time a new message is received. My system updates the div with ...

How to implement datepicker on multiple input fields

Below are the two input fields that have datepicker functionality: <div class="row"> <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min="minDate" max="'2015-06-22&apos ...

Is there a way to use CSS to generate a disappearing triangle-shaped div that will only vanish when clicked directly on the triangle and not when clicked on the surrounding overflow area?

In a different discussion, it was mentioned that the method used to create a CSS triangle allows for triggering the hover state or click event only when the cursor is inside the triangle. There is a demo provided to demonstrate this with the hover state. ...

Translating MySQL data into JavaScript using PHP

Hey everyone, I'm having trouble utilizing MySQL row values in JavaScript. Despite experimenting with various combinations of quotes and double-quotes. $sql = "SELECT desk_id, desk_x, desk_y FROM desks"; $result = $conn->query($sql); if ($result- ...

What is the best way to execute code after an element has been included in ngFor in Angular 2+?

Within my component, there is a function that adds an element to an array displayed using *ngFor in the view. After adding the element to the array, I want to target it by ID and scroll to it. However, the issue is that this code runs before the element a ...

Implementing an All-Routes-Except-One CanActivate guard in Angular2

In order to group routes within a module, I am aware that it can be done like this: canActivate: [AuthGuard], children: [ { path: '', children: [ { path: 'crises', component: ManageCrisesComponent }, ...

Adjust THREE.PerspectiveCamera's distance without altering its viewing orientation

I have a PerspectiveCamera in THREE.js positioned somewhere in space as a child of a mesh. The camera is currently looking at the mesh with local coordinates [0, 0, 0]. I am looking for a way to change the distance of the camera from the mesh without chang ...

Adjust the sound levels with a sleek jQuery UI volume slider

Currently, I am working on developing a customized volume slider for FlowPlayer that is built upon the standard jQuery UI Slider. I am seeking assistance in establishing a connection between this slider and the HTML5 video volume controls. Below is the co ...