Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Call function inside module on javascript?

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>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!