three.js Basic Scene not Loading - javascript

I am trying to create the basic scene but nothing is loading on my HTML page. I don't know where to get the three.js file that I need to place inside my js folder before I can reference it as instructed on the docs page ().
Please can someone explain how I can import this file and add it into my js folder?

It would be helpful if you could share some code to judge if this is an internal problem.
First of all, if you make references to local files, you'll need to run things locally running a local server (for instance I run python -m http.server, then access my files in the browser from localhost:8000).
The other problem could be that your version of three.js or three.min.js is not the good one, you can actually get them from the github build folder, and place them in the same repo as your html file, to be able to import them (<script type="text/javascript" src="three.min.js"></script>).
Finally, you could also see what's going wrong in your console if you work on Firefox for instance, it might help you to solve your error.

Related

How can i import pdf files dynamically into react

i am working on a react app, created using "create-react-app". i have many pdf files stored in my public folder, inside an assets folder: public/assets/file.pdf
my app has to be running locally (without web server) and i need to load these files in order to display them. i cannot store the files elsewhere and get them via axios. it has to be from the public path
If someone has the info on how to do this, please enlighten me. thank you
I have tryed to do it this way : import("assets/filename")
i tried to put different urls, i took a look at the webpack config even tho i am no expert.
But it doesn't seem to work at all.
Take a look a react-pdf, it may help

can't understand why my js file is not found on client console

this probably is a newbie question, please don't be mean :D
I'm trying to add a js file to an html page, but can't load it properly. It seems to be a path related issue.
in the HTML page I'm linking the file with
<script src="../src/utils/mapbox.js"></script>
Then on my js file I simply put a console.log to see if the file is loaded properly, but it isn't :/
I tried everything but nothing changes.
screenshot of the debug console
screenshot of the source tab of the debuggin tool
On the second image, I can't see all of my folders I have on VSCode. It is because those file are server side right? If so, how can I solve the issue? :/
this is the folder structure in VSCode
Thanks in advance.
The value of the src attribute needs to be a URL to the JS file.
If you use a relative URL, it needs to be relative to the URL of the HTML document.
This is not the same as the path between the EJS template used to generate the HTML and a JS file on the local filesystem.
First you need to give the JS file a URL. You haven't shown the source code you've written for your websever, but it seems like a reasonable assumption to say that you have used the Express.js static module to make the contents of the public directory accessible.
The src directory is not inside public so it isn't accessible. It also appears to be a directory containing your server-side source code, so it isn't a suitable place to keep your client-side JS.
Move the client-side JS files into a directory inside the public directory.
(If you are writing isomorphic JS then you could create a new directory, perhaps called shared, and expose it using static too).
Once that is done, you can work out the URL to the JS file.
ok I digged into that issue and so basically, I was confusing between client side and server side. I looked at the mapbox api docs and immediately I clicked on the npm quick guide, but this is just for limited cases, when you need to render a map on the server.
All I needed to follow was the web js api of the mapbox service.
So thanks for the comments, I'll try to noob less and study more! :)

PWA not finding javascript files in directories

I'm trying for a while now to create a PWA in Oracle APEX by following some instructions on http://vmorneau.me/apex-pwa-part4/, but I'm having no luck in certain parts.
I've installed the demo to test it and see what's wrong, but I'm having the same issues with the demo app, namely some important files not being detected/found when I run it. I thought I had configured something wrong previously, but this time it was supposed to work properly.
Example, I have the app.js inside the js directory in Apex:
When I run the app, I get these messages:
I tried checking the file path the same way I tried to see if the manifest.json file was in the proper root folder, and it couldn't be found:
This looks like a common problem I see on the forums, that doesn't relate to the PWA concept. You'll probably find the same thing if you tried to refer to static files loaded into the workspace.
See Morten's example regarding a fixing the configuration
https://ora-00001.blogspot.com/2016/12/apex-plugin-files-and-404-not-found-in-ords.html
Or placed your files in the middle tier, using /i/ (or preferrably a custom location /c/)

Eclipse JSDT autocomplete not working

I've done research and see this is a recognized issue. I guess my question will be: Is there a solution in Eclipse Mars or in Neon? Another plugin for JavaScript Content Assist?
I'm running Eclipse Mars and have a project with Java and JavaScript (uses ScriptEngineManager). JavaDoc/AutoComplete is working in Java but not in JS files. It Was working but then just stopped. I've restarted, rebooted, refreshed, rebuilt. No joy. The error reported is :
An exception occurred while getting the JSDoc. See log for details.
(in the log: ) file.js [in [in ...Workspace\.metadata\.plugins\org.eclipse.wst.jsdt.core\libraries\system.js]] does not exist
I deleted and re-defined the workspace. No joy. Mouseover the keyword Array and it does show system.jsArray with ECMA info. But mouseover String and it shows src/docs/jsString. "src/docs" is a path in my project.
I'm thinking it's just looking in the wrong place for the docs but I don't know where to set that. I've read that there is a bug where auto complete only works within a file. This seems to be consistent where it's still looking within the current file for the definition of everything.
I can get String to refer back to system.jsString if I add an invalid function. But if I fix the function it goes back to looking in my src/docs. Go figure.
Maybe the project structure is wrong (this is FOSS I got from Github). In the root of the project there are src/foo folders with packages and .java source, a reference to the JRE System Library, a couple .jars, and another src folder with src/docs/java with .java files and src/docs/js with .js files. Do I need to change the folder type of src or do something else to it so that it's recognized as a code folder? Right now it's in the project explorer with a common "folder" icon, not like one of the package source folders.
Do I need Neon? Do I need another IDE?
This suggestion to update the .project didn't help.
I'm going to try the package "Eclipse IDE for JavaScript and Web Developers" but I dont know if that will help with this Java/JS hybrid project. I'm also going to try Atom.
Thanks.

How do I use fabric.js with Meteor using the script tag?

I'm new to Meteor. I've managed to make some simple programs using both Meteor and Fabric.js, but now that I'm trying to use them both together I can't get it to work.
I'm including Fabric.js by using a script tag in the head of the main html file, but when I call fabric.Canvas from my client JS it doesn't recognize the library. The error that I get in the Firefox JS console is "ReferenceError: fabric is not defined". I placed the js file in my public directory.
I've looked around on SO and saw threads about including node modules, but I simply want to use the js file instead of including a whole module. I did find a project on GitHub that uses the script tag without a problem: https://github.com/6/realtime-fabric I'm not familiar with CoffeeScript so perhaps I'm missing something, but I don't think he's doing anything different from me. Any help that you could offer would be greatly appreciated!
Add a 'client' directory to your project and place the fabric.js file in there. Meteor bundles the files in this directory and sends them to the client. You should not need to use a script tag in your HTML.
http://docs.meteor.com/#structuringyourapp

Categories