Skip to content
Snippets Groups Projects
Commit 8f310a40 authored by AKIFI NAIL's avatar AKIFI NAIL
Browse files

casque vr mobile zoom (push pour plesk et test)

parent d24ec063
Branches
No related merge requests found
console.log("container");
import * as THREE from "https://cdn.skypack.dev/three@0.129.0/build/three.module.js";
import { OrbitControls } from "https://cdn.skypack.dev/three@0.129.0/examples/jsm/controls/OrbitControls.js";
......@@ -63,6 +62,7 @@ controls.dampingFactor = 0.25;
controls.screenSpacePanning = false;
controls.enableZoom = false;
// Charger un modèle FBX
// Charger un modèle FBX
const loader = new FBXLoader();
loader.load(
......@@ -82,15 +82,20 @@ loader.load(
let endPosition;
if (isMobile) {
endPosition = new THREE.Vector3(-440, 150, 100);
// Définir directement la position de la caméra pour les mobiles
camera.position.copy(endPosition);
controls.target.copy(center);
controls.update();
} else {
endPosition = new THREE.Vector3(-520, 150, 100);
}
const duration = 3000; // Durée en millisecondes (3 secondes)
// Écouter l'événement scroll pour déclencher l'animation
// Écouter l'événement scroll pour déclencher l'animation uniquement sur desktop
let animationTriggered = false;
window.addEventListener("scroll", () => {
if (window.scrollY > 1050 && !animationTriggered) {
if (!isMobile && window.scrollY > 1050 && !animationTriggered) {
console.log(window.scrollY);
animationTriggered = true; // Empêche de relancer l'animation plusieurs fois
animateCamera(startPosition, endPosition, duration, center);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment