简体   繁体   中英

Referencing Three.js in HTML

I am using c9.io, an IDE to code and quickly run a site to test your code. I have tried importing this outside of c9, and it still does not work. (I know it isn't a script error related to three.js itself.) In my HTML, I have this snippet:

<body>
   <script src='three.min.js'></script>
   <script src='scene1.js'></script>
</body>

I require the THREE namespace in my scene1 JavaScript like this:

import THREE from "three.min.js";

Is this all correct? Someone has tested this code, and said it worked. I have no folders in my hierarchy, just the three.min.js script, the scene1.js script, and my HTML script. Can anyone spot my error out?

尽管每个教程和three.js文档都说该脚本应该放在正文中,但是将脚本放在标头中的效果很好。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM