three.js

Fill Area between Lines with color - Three.js

旧巷老猫 提交于 2020-05-27 04:58:50
问题 I have series of lines, and I need to color all the area beneath or between lines with a color. For the sake of simplicity, I have created a snippet with closed lines. In reality, i have a program that draws many lines (like a stock market graph) , and I need to color all the area below the graph. see also the screenshot. would appreciate any help or even new approach that maybe I need to take. <html> <head> <title>My first three.js app</title> <style> body { margin: 0; } canvas { width: 100%

Fill Area between Lines with color - Three.js

落花浮王杯 提交于 2020-05-27 04:58:26
问题 I have series of lines, and I need to color all the area beneath or between lines with a color. For the sake of simplicity, I have created a snippet with closed lines. In reality, i have a program that draws many lines (like a stock market graph) , and I need to color all the area below the graph. see also the screenshot. would appreciate any help or even new approach that maybe I need to take. <html> <head> <title>My first three.js app</title> <style> body { margin: 0; } canvas { width: 100%

Uncaught SyntaxError: Cannot use import statement outside a module

南笙酒味 提交于 2020-05-21 07:42:07
问题 https://www.youtube.com/watch?v=1TeMXIWRrqE <!DOCTYPE html> <html> <head> <title>Three.js</title> <style type="text/css"> html, body {margin: 0; padding: 0; overflow: hidden} </style> </head> <body> <div id="webgl"></div> <script src="three.js"></script> <script src="GLTFLoader.js"></script> <script> let scene,camera,renderer; function init(){ scene = new THREE.Scene(); scene.background = new THREE.Color(0xdddddd); camera = new THREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1

Uncaught SyntaxError: Cannot use import statement outside a module

你。 提交于 2020-05-21 07:39:14
问题 https://www.youtube.com/watch?v=1TeMXIWRrqE <!DOCTYPE html> <html> <head> <title>Three.js</title> <style type="text/css"> html, body {margin: 0; padding: 0; overflow: hidden} </style> </head> <body> <div id="webgl"></div> <script src="three.js"></script> <script src="GLTFLoader.js"></script> <script> let scene,camera,renderer; function init(){ scene = new THREE.Scene(); scene.background = new THREE.Color(0xdddddd); camera = new THREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1

Getting uneven click-detection on 3d-objects on mapbox with raycaster

瘦欲@ 提交于 2020-05-17 06:05:41
问题 I am using raycaster in mapbox with 3d-objects. I need to detect the click on the 3d-object.But When I click on the object I get a empty raycaster.intersectObject (array) sometimes and filled array sometimes, rather it should always have the 3d object that I have clicked. I have a simple map as explained here. I have only added the raycasting part to it to keep it as simple as possible. Here is my code. var longitude, latitude, diff, map, destLongitude, destLatitude, distFrmlast = 0; var

Add text with geometry in threejs

青春壹個敷衍的年華 提交于 2020-05-16 08:06:29
问题 I want to attach text to the bottom part of the rings (where the cuts are) as you can see in the image below. You can see the code I am using to draw the rings. I want to write the radius (40m, 30m, 20m) where the cuts are and I would prefer that they are merged because I will be zooming them in and out and want them to stay connected to the rings. // Rings // 40m ring const geometry40m = new THREE.RingGeometry(35, 35.6, 30, 8, 4.85, 6); geometry40m.lookAt(this.CAMERA_POSITION); const

Add text with geometry in threejs

 ̄綄美尐妖づ 提交于 2020-05-16 08:06:09
问题 I want to attach text to the bottom part of the rings (where the cuts are) as you can see in the image below. You can see the code I am using to draw the rings. I want to write the radius (40m, 30m, 20m) where the cuts are and I would prefer that they are merged because I will be zooming them in and out and want them to stay connected to the rings. // Rings // 40m ring const geometry40m = new THREE.RingGeometry(35, 35.6, 30, 8, 4.85, 6); geometry40m.lookAt(this.CAMERA_POSITION); const

Three.js error --> THREE.Scene is not a constructor

大兔子大兔子 提交于 2020-05-15 18:21:39
问题 I can't execute my code because of this error: TypeError: THREE.Scene is not a constructor I use the three.js file from the official github repo and here are my files: index.html <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="../style.css"> <title>First three.js</title> </head> <body> <script type="module" src="../frontend/tetrahedrons_render.js"></script> </body> </html> tetrahedrons_render.js

THREE.js - Merging / Instancing Multiples of The Same GLTF Model, Without Shader Material..?

こ雲淡風輕ζ 提交于 2020-05-14 09:09:42
问题 I am using the code below to load and clone a GLTF model. In practice this works, however it is way too resource heavy and the model is around a 2mb. It has no textures and the materials are a single MeshPhongMaterial. I understand two ways to optimise this are to merge them into one mesh instead of cloning, however following numerous attempts (such as iterating within the load function with a for loop), I haven't been able to successfully do this. The second being instancing, however from a

THREE.js - Merging / Instancing Multiples of The Same GLTF Model, Without Shader Material..?

怎甘沉沦 提交于 2020-05-14 09:08:26
问题 I am using the code below to load and clone a GLTF model. In practice this works, however it is way too resource heavy and the model is around a 2mb. It has no textures and the materials are a single MeshPhongMaterial. I understand two ways to optimise this are to merge them into one mesh instead of cloning, however following numerous attempts (such as iterating within the load function with a for loop), I haven't been able to successfully do this. The second being instancing, however from a