I'm starting a project that uses three.js library, and I will use also a parallax library. The 3D effects will be only decorative, but parallax will trigger it.
I modified this example and works fine for me: demo: https://threejs.org/examples/#webgl_geometry_text_shapes code: https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_text_shapes.html
...but I need to send the title of every section (when the user enter on it by scrolling down) to the 3D script code, and it is closed inside a module.
...How to to it? I'm newbie into three.js and modules, and want to keep the parallax as is (outside module, because it's a well-known library and part of developed yet project)
Maybe the right way is transform the sample code, without modules... but I'm lost with it... for example, the starting part of JS in module, are:
import * as THREE from 'three';
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { SVGLoader } from './jsm/loaders/SVGLoader.js';
import { FontLoader } from './jsm/loaders/FontLoader.js';
...how to do it without modules / import?
Thanks in advance
==================================
I add an example (maximum simplified) about what I need (and not works):
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - simple text from json</title>
</head>
<body>
<script type="module">
init();
function init() {
function hi( text) {
alert(text);
}
} // end init
</script>
<script>
init().hi("hi world");
</script>
</body>
</html>
I solved this turning the code into regular JS, not module JS.
In the library three.js, there is for each control a version for module (into /jsm folder) and normal JS version (/js folder).
Also changed the main file three.module.js for three.js file.
Thank you