I everyone, I’m stuck with this since 4h hours now…
Try everything I can…
import * as THREE from "three";
import Experience from "../Experience.js"
import GSAP from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger.js";
export default class Controls {
constructor() {
this.experience = new Experience();
this.scene = this.experience.scene;
this.sizes = this.experience.sizes;
this.resources = this.experience.resources;
this.time = this.experience.time;
this.camera = this.experience.camera;
this.room = this.experience.world.room.actualRoom;
GSAP.registerPlugin(ScrollTrigger);
this.setPath();
console.log("prout");
}
setPath(){
console.log("prout");
this.timeline = new GSAP.timeline();
this.timeline.to(this.room.position, {
x: 5,
duration: 20,
});
}
resize() {}
update() {
}
}
This is Controls and the next one is Experience
import * as THREE from "three";
import Sizes from "./Utils/Sizes.js";
import Time from "./Utils/Time.js";
import Resources from "./Utils/Resources.js";
import assets from "./Utils/assets.js";
import Camera from "./Camera.js";
import Renderer from "./Renderer.js";
import World from "./World/World.js"
import Controls from "./World/Controls.js";
export default class Experience{
static instance
constructor(canvas){
if(Experience.instance){
return Experience.instance
}
Experience.instance = this;
this.canvas = canvas;
this.scene = new THREE.Scene();
this.time = new Time();
this.sizes = new Sizes();
this.camera = new Camera();
this.renderer = new Renderer();
this.resources = new Resources(assets);
this.world = new World();
this.controls = new Controls();
this.time.on("update", ()=>{
this.update();
})
this.sizes.on("resize", ()=>{
this.resize();
})
}
update(){
this.camera.update();
this.renderer.update();
this.world.update();
this.controls.update();
}
resize(){
this.camera.resize();
this.renderer.resize();
this.world.resize();
}
}
Thank’s for your help !!!