Hello!
I started learning three.js a few days ago, and I cannot find any information online that works about how you run a html file with three.js javascript coding.
This is how I have done:
I have a folder on my desktop named Threegame. Inside I have two files:
My html file with all my code, and the Three.min.js file
When I open my html file in my browser using Notepad++ ("run < launch in crome") nothing happens. And I dont think there is something wrong with my html code because when I use my code on Codecademy.com's code editor in their exercises it works and displays a three.mesh as a floor and the movements of the camera is working.
Here is my code.
Feel free to change the code as you are trying to help me :)
Tnx!
Related
I wanted to learn a lil bit of website coding so I decided I want to see how a website is written. I used HTTrack Website Copier to copy a website and then i opend the index.html document. Now I saw a row where it says "-- Please enable Javascript --</p". How do I enable javascript to see what normaly would stand in that row? Also i dont have any html oder css file in the folder where HTTrack put the index.html into. Is that normal?
I dont know what to do about this cause i started 2days ago^^
Chances are, that page you copied is referencing a JavaScript file that you didn't download with the HTML file. Look through your HTML for a <script src="...">...</script> tag or something similar; that's the missing file. Same goes for the CSS, except that will be near the top with <link rel="stylesheet" href="styles.css">.
HTML is how the page is laid out. CSS is how the page looks (font sizes, colors, etc). JavaScript is how the page works (interactive features). I'd start with just basic HTML, you're kind of jumping in on the deep end. Codecademy has great (and free) introductory courses that should help you understand what you're looking at better.
I want to embed an interactive diagram in my Readymag page via iframe, but the diagram won't show up. I performed a test in JSFiddle: https://jsfiddle.net/TheFelipeGarcia/2p3aguck/, and it works there.
First, I exported my infographic as HTML + JavaScript from Adobe Animate. Then, I used Readymag's Widget Code to add the code to my page. A side note: originally the HTML had a link to the JS file
<script src="infographic.js?1578942235513"></script>
but I pasted the JS inline (it's very long so I won't repaste here).
Does anyone have experience with Readymag or a similar issue of embedding iframes, that might have ideas what I could be doing wrong?
I am trying to load a pde (processing) file with an html webpage so that they can work together.
In the main folder of the website there are the pde file and the processing.js library file.
I wrote this string of code in the "head":
<script type="text/javascript" src="/scripts/processing.js"></script>
Then at the end of "body" I wrote the "canvas" string:
<canvas id="your-id-here" data-processing-sources="file1.pde"></canvas>
The webpage that I am working on is really simple, there is only a text link list. When I test the index.html the webpage is displayed correctly but the pde doesn't work. I also noticed that because of the "canvas" string the last link doesn't work anymore.
The pde code is a sample copied from the Processing website, basically is drawing with the mouse just when you press the mouse button.
Thank you for your help in advice!
Make sure you're checking the developer tools for errors. Specifically, look at your JavaScript console and the networking tab.
Like you've discovered, you can use Processing.js to deploy simple Processing sketches to the web. Note that Processing.js is pretty old now, so you should only use it if you really need to. If deploying to the web is a priority, you should consider switching to P5.js.
Shameless self-promotion: here is a guide on using Processing.js to deploy a Processing sketch.
If you still can't get it working, please provide the full text of any errors you're receiving, as well as a MCVE that demonstrates exactly what you're doing.
I am trying to get this: https://github.com/antimatter15/ocrad.js demo to work for me. Some of the elements will show up and function correctly when I download the files and open up the .html on my home machine. Some of them will not--I can draw and upload pictures, but the text recognition script features do not run. Has anyone been successful in recreating an ocr javascript demo? I am using the code from the github link above.
I'm having a (simple) issue, but I have no idea how to fix it. Essentially, every tutorial I have come across for Babylon puts all of the Javascript code inside < script > tags in the main HTML page.
However, I would like to have all of my Javascript code inside a separate file. I have tried every way of loading it as I could think of, though I am a novice at Javascript (I am decent at C++, and I can see the similarities); yet I was unable to make it load. (It works fine when called from the HTML page itself).
Does anyone know what (if anything) I can do in order to be able to load my scripts from external files, and still get everything to work? Thanks in advance!
2 options:
register to the DOMContentLoaded event in your external JS file
reference your JS file with the tag at the end of the HTML page
You can find a sample in one of my tutorials here: http://blogs.msdn.com/b/davrous/archive/2014/11/18/understanding-collisions-amp-physics-by-building-a-cool-webgl-babylon-js-demo-with-oimo-js.aspx
Enjoy and thanks for using Babylon.js! :)
David