Trigger Threejs and Tweenjs from outside the scope


i use skypack modules for Threejs and Tween => no problem
But my canva is a part of my html, and i want to use custom function to trigger interaction with it
it’s ok by moving the declration of scene, camera, controlls etc. but i fail to do it with Tween.

My code is not best practices and under dev
You can look it at the source code here : : Visualisation 3D de la TimeLine

Brefiely :


        let camera, controls, scene, raycaster, renderer;//,labelRenderer;

        function GO(item){
            const mytarget=scene.getObjectByProperty('ref',item,true)
            const p = mytarget.position;
            let n=p.clone();


            //scene.positionTween = new TWEEN.Tween(camera.position).easing(TWEEN.Easing.Quadratic.InOut);
           // scene.rotationTween = new TWEEN.Tween(;


    <script type="module">

        // Find the latest version by visiting

        import * as THREE from '';
        import * as TWEEN  from '';

Any suggestion to enable tween transition on my custom js function ?

any javascript file should be a module. if you import something in a.js and then again in b.js, both will access the same namespace, TWEEN and THREE will be the same thing among all modules. as for accessing scene imo you should avoid globals. just use dependency injection:

function go(scene, item) {

btw why not use a bundler? this would be all so incredibly simple.