Phase 4 perf : facades YouTube, boucles d'animation stoppees hors ecran/inactives, will-change permanents retires

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cette révision appartient à :
Théo GastineletClaude Opus 5.5 a révisé 2026-10-12 15:41:49 +02:00
1 Parent 18a8e3bc8e
révision b961aae31f
1 fichier modifié
+58 -10
+58 -10
Voir le fichier
@@ -292,7 +292,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
.global-footer .footer-bottom { text-align:center; border-top:1px solid #333; margin-top:40px; padding-top:20px; font-size:.8rem; color:#888; }
@media (max-width:768px){ .global-footer .footer-content{ grid-template-columns:1fr; gap:30px; } }
.reveal,.reveal-left,.reveal-right { opacity:0; will-change:opacity,transform; transition:opacity .8s cubic-bezier(.25,1,.5,1),transform .8s cubic-bezier(.25,1,.5,1); }
.reveal,.reveal-left,.reveal-right { opacity:0; transition:opacity .8s cubic-bezier(.25,1,.5,1),transform .8s cubic-bezier(.25,1,.5,1); }
.reveal{ transform:translateY(40px); }
.reveal-left{ transform:translateX(-40px); }
.reveal-right{ transform:translateX(40px); }
@@ -694,7 +694,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
#realisations .gallery-item { break-inside:avoid; margin-bottom:28px; position:relative; overflow:hidden; background:transparent; cursor:pointer; }
#realisations .gallery-item::after { content:''; position:absolute; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0); transition:background .4s ease; pointer-events:none; z-index:1; }
#realisations .gallery-item:hover::after { background:rgba(0,0,0,.08); }
#realisations .gallery-item img { width:100%; height:auto; display:block; transition:transform .6s cubic-bezier(.25,.8,.25,1); will-change:transform; }
#realisations .gallery-item img { width:100%; height:auto; display:block; transition:transform .6s cubic-bezier(.25,.8,.25,1); }
#realisations .gallery-item:hover img { transform:scale(1.04); }
#realisations .gallery-caption { position:relative; z-index:2; display:block; background:#fdfdfd; padding:12px 2px 0 2px; font-size:.82rem; font-weight:500; color:#666; letter-spacing:.04em; text-transform:uppercase; }
#realisations .gallery-item.hidden { display:none; }
@@ -728,6 +728,13 @@ body.spa-nav-hidden .spa-nav { display:none; }
#realisations .video-main-title { font-family:var(--font-sans); color:#111; text-align:center; font-size:2rem; letter-spacing:-.01em; margin-bottom:60px; font-weight:700; }
#realisations .video-wrapper { position:relative; width:100%; aspect-ratio:16/9; background:#000; border-radius:4px; overflow:hidden; box-shadow:0 8px 20px rgba(0,0,0,.1); }
#realisations .video-wrapper iframe { position:absolute; top:0; left:0; width:100%; height:100%; border:0; }
/* Façade YouTube : l'iframe (~1 Mo de JS YouTube) n'est créée qu'au clic. */
#realisations .yt-facade { position:absolute; inset:0; width:100%; height:100%; border:0; padding:0; margin:0; cursor:pointer; color:#fff; font:inherit; background:#050505 radial-gradient(ellipse at 50% 40%,#2a2a2a 0%,#0b0b0b 70%) center/cover no-repeat; }
#realisations .yt-facade-play { position:absolute; top:50%; left:50%; width:72px; height:72px; margin:-36px 0 0 -36px; border-radius:50%; background:rgba(255,255,255,.92); display:flex; align-items:center; justify-content:center; box-shadow:0 8px 24px rgba(0,0,0,.35); transition:transform .3s cubic-bezier(.25,1,.5,1),background .3s ease; }
#realisations .yt-facade-play svg { width:22px; height:22px; margin-left:4px; fill:#111; }
#realisations .yt-facade:hover .yt-facade-play,#realisations .yt-facade:focus-visible .yt-facade-play { transform:scale(1.08); background:#fff; }
#realisations .yt-facade:focus-visible { outline:2px solid #fff; outline-offset:-4px; }
#realisations .yt-facade-title { position:absolute; left:18px; right:18px; bottom:16px; text-align:left; font-family:var(--font-sans); font-size:.8rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; text-shadow:0 1px 6px rgba(0,0,0,.6); }
#realisations .vid-title { font-family:var(--font-sans); font-size:1.2rem; font-weight:600; color:#0a192f; margin:0 0 15px 0; text-transform:uppercase; }
#realisations .vid-meta { font-size:1.1rem; margin-bottom:10px; color:#222; }
#realisations .vid-meta strong { font-weight:700; }
@@ -767,7 +774,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
#apropos a { color:#000; text-decoration:none; transition:all .3s ease; }
#apropos .main-container { max-width:1200px; margin:0 auto; padding:0 20px; }
#apropos .reveal { opacity:0; transform:translateY(30px); will-change:opacity,transform; transition:opacity .8s cubic-bezier(.25,1,.5,1),transform .8s cubic-bezier(.25,1,.5,1); }
#apropos .reveal { opacity:0; transform:translateY(30px); transition:opacity .8s cubic-bezier(.25,1,.5,1),transform .8s cubic-bezier(.25,1,.5,1); }
#apropos .reveal.active { opacity:1; transform:translate(0,0); }
#apropos .animated-separator { width:40px; height:3px; background:#111; margin:70px auto; border:none; border-radius:2px; animation:pulseWidth 4s infinite ease-in-out; }
@keyframes pulseWidth { 0%{width:40px;opacity:.4;} 50%{width:120px;opacity:1;} 100%{width:40px;opacity:.4;} }
@@ -1767,7 +1774,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
<section class="video-section">
<h2 class="video-main-title">Perspectives en mouvement</h2>
<div class="video-hero">
<div class="video-wrapper"><iframe src="https://www.youtube-nocookie.com/embed/nknh43cnKXI" title="THE FROZEN WORLD" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen loading="lazy"></iframe></div>
<div class="video-wrapper"><button type="button" class="yt-facade" data-yt="nknh43cnKXI" aria-label="Lire la vidéo : THE FROZEN WORLD"><span class="yt-facade-play" aria-hidden="true"><svg viewBox="0 0 384 512"><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg></span><span class="yt-facade-title">THE FROZEN WORLD</span></button></div>
<div class="video-hero-text">
<h3 class="vid-title">THE FROZEN WORLD</h3>
<p class="vid-meta"><strong>Spot :</strong> Rocher de l'Avocat (Vercors)</p>
@@ -1789,7 +1796,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
</div>
<div class="video-grid">
<div class="video-card">
<div class="video-wrapper"><iframe src="https://www.youtube-nocookie.com/embed/TPllEu3BK80" title="Les 3 Pucelles" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen loading="lazy"></iframe></div>
<div class="video-wrapper"><button type="button" class="yt-facade" data-yt="TPllEu3BK80" aria-label="Lire la vidéo : Les 3 Pucelles"><span class="yt-facade-play" aria-hidden="true"><svg viewBox="0 0 384 512"><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg></span><span class="yt-facade-title">Les 3 Pucelles</span></button></div>
<div class="video-card-text">
<p class="vid-meta"><strong>Spot :</strong> Les 3 Pucelles (Vercors)</p>
<p class="vid-meta"><strong>Matériel :</strong> DJI Mini 4 Pro</p>
@@ -1809,7 +1816,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
</div>
</div>
<div class="video-card">
<div class="video-wrapper"><iframe src="https://www.youtube-nocookie.com/embed/-YunbJMgJ4g" title="Plateau de la Molière" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen loading="lazy"></iframe></div>
<div class="video-wrapper"><button type="button" class="yt-facade" data-yt="-YunbJMgJ4g" aria-label="Lire la vidéo : Plateau de la Molière"><span class="yt-facade-play" aria-hidden="true"><svg viewBox="0 0 384 512"><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg></span><span class="yt-facade-title">Plateau de la Molière</span></button></div>
<div class="video-card-text">
<p class="vid-meta"><strong>Spot :</strong> Contrebas du Plateau de la Molière</p>
<p class="vid-meta"><strong>Matériel :</strong> DJI Mini 4 Pro</p>
@@ -2688,6 +2695,16 @@ var DEFAULT='accueil';
var done={};
var Anim={};
function switchAnim(route){ Object.keys(Anim).forEach(function(k){ if(k===route) Anim[k].start(); else Anim[k].stop(); }); }
// Façades YouTube : remplace le bouton par l'iframe au clic, lecture immédiate.
document.addEventListener('click',function(e){
var btn=e.target.closest&&e.target.closest('.yt-facade'); if(!btn) return;
var f=document.createElement('iframe');
f.src='https://www.youtube-nocookie.com/embed/'+btn.getAttribute('data-yt')+'?autoplay=1&rel=0';
f.title=btn.querySelector('.yt-facade-title').textContent;
f.allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture';
f.allowFullscreen=true;
btn.replaceWith(f); f.focus();
});
function initTabs(btns,activate){
btns=Array.prototype.slice.call(btns);
btns.forEach(function(btn){
@@ -2909,7 +2926,7 @@ var Modules={
var customCursor=document.getElementById('custom-cursor');
var mouseX=0,mouseY=0,cursorX=0,cursorY=0,dotX=0,dotY=0;
var customCursorDot=document.getElementById('custom-cursor-dot');
document.addEventListener('mousemove',function(e){ mouseX=e.clientX; mouseY=e.clientY; });
document.addEventListener('mousemove',function(e){ mouseX=e.clientX; mouseY=e.clientY; wakeCursor(); });
var cursorRaf=null;
var lastIsDark=false, checkLumTick=0;
@@ -2970,8 +2987,18 @@ var Modules={
if(++checkLumTick%2===0){
updateCursorLuminance();
}
// Curseur arrivé sous la souris : on coupe la boucle (mousemove/scroll la relancent).
if(Math.abs(mouseX-cursorX)<0.1&&Math.abs(mouseY-cursorY)<0.1&&Math.abs(mouseX-dotX)<0.1&&Math.abs(mouseY-dotY)<0.1){
updateCursorLuminance(); cursorRaf=null; return;
}
cursorRaf=requestAnimationFrame(animateCursor);
}
function wakeCursor(){
if(reduceMotion||cursorRaf!==null) return;
if(!document.getElementById('accueil').classList.contains('active')) return;
cursorRaf=requestAnimationFrame(animateCursor);
}
window.addEventListener('scroll',wakeCursor,{passive:true});
if(!reduceMotion){ cursorRaf=requestAnimationFrame(animateCursor); document.body.classList.add('custom-cursor-ready'); }
document.querySelectorAll('a, button, .carousel-arrow, .carousel-control-btn, .floating-card').forEach(function(el){
el.addEventListener('mouseenter',function(){ customCursor.classList.add('hovered'); });
@@ -3055,6 +3082,8 @@ var Modules={
function applyPPIcon(ic){ if(!playPauseIcon) return; playPauseIcon.setAttribute('viewBox',ic.v); var p=playPauseIcon.querySelector('path'); if(p) p.setAttribute('d',ic.d); }
function togglePlay(){ isPaused=!isPaused; applyPPIcon(isPaused?PP_PLAY:PP_PAUSE); }
playPauseBtn.addEventListener('click',togglePlay);
// Mouvement réduit ou mode économie de données : pas de défilement automatique.
if(reduceMotion||(navigator.connection&&navigator.connection.saveData)){ isPaused=true; applyPPIcon(PP_PLAY); }
function triggerCrossShake(){ if(modalCross){ modalCross.classList.remove('shake-active'); void modalCross.offsetWidth; modalCross.classList.add('shake-active'); setTimeout(function(){ modalCross.classList.remove('shake-active'); },2000); } }
if(storeModal && openStoreBtn){
initModal(storeModal,{
@@ -3065,8 +3094,17 @@ var Modules={
prevBtn.addEventListener('click',prevSlide); nextBtn.addEventListener('click',nextSlide);
carouselWindow.classList.add('revealed');
updatePos(); animId=requestAnimationFrame(runBar);
// Carrousel hors écran : la barre de progression (et donc l'autoplay) se met en pause.
var carouselVisible=true;
if('IntersectionObserver' in window){
new IntersectionObserver(function(entries){
carouselVisible=entries[0].isIntersecting;
if(!carouselVisible){ if(animId!==null){ cancelAnimationFrame(animId); animId=null; } }
else if(animId===null&&document.getElementById('accueil').classList.contains('active')){ lastTime=null; animId=requestAnimationFrame(runBar); }
}).observe(carouselWindow);
}
Anim.accueil={
start:function(){ if(!reduceMotion&&cursorRaf===null) cursorRaf=requestAnimationFrame(animateCursor); if(animId===null){ lastTime=null; animId=requestAnimationFrame(runBar); } },
start:function(){ if(!reduceMotion&&cursorRaf===null) cursorRaf=requestAnimationFrame(animateCursor); if(animId===null&&carouselVisible){ lastTime=null; animId=requestAnimationFrame(runBar); } },
stop:function(){ if(cursorRaf!==null){ cancelAnimationFrame(cursorRaf); cursorRaf=null; } if(animId!==null){ cancelAnimationFrame(animId); animId=null; } }
};
},
@@ -3164,10 +3202,20 @@ var Modules={
var floatingCloudBtn=root.querySelector('#floatingCloudBtn');
var startTime=Date.now();
var frameRaf=null;
function frame(){ var elapsed=Date.now()-startTime; if(floatingCloudBtn&&window.innerWidth>=1024){ floatingCloudBtn.style.transform='translate3d(0,'+(Math.sin(elapsed/800)*12)+'px,0)'; } else if(floatingCloudBtn&&floatingCloudBtn.style.transform!=='none'){ floatingCloudBtn.style.transform='none'; } if(lightbox.classList.contains('active')&&!isDragging&&postItWrapper.style.display==='block'){ var fy=Math.sin(elapsed/1200)*4; var fr=Math.cos(elapsed/1500)*1.5; postItWrapper.style.transform='translate3d('+currentX+'px,'+(currentY+fy)+'px,0) rotate('+(baseRot+fr)+'deg)'; } frameRaf=requestAnimationFrame(frame); }
function frame(){ var elapsed=Date.now()-startTime; if(floatingCloudBtn&&window.innerWidth>=1024){ floatingCloudBtn.style.transform='translate3d(0,'+(Math.sin(elapsed/800)*12)+'px,0)'; } else if(floatingCloudBtn&&floatingCloudBtn.style.transform!=='none'){ floatingCloudBtn.style.transform='none'; } if(lightbox.classList.contains('active')&&!isDragging&&postItWrapper.style.display==='block'){ var fy=Math.sin(elapsed/1200)*4; var fr=Math.cos(elapsed/1500)*1.5; postItWrapper.style.transform='translate3d('+currentX+'px,'+(currentY+fy)+'px,0) rotate('+(baseRot+fr)+'deg)'; } frameRaf=needsFrame()?requestAnimationFrame(frame):null; }
// La boucle ne tourne que s'il y a quelque chose à animer : bouton flottant
// visible sur grand écran, ou post-it dans la lightbox ouverte.
var cloudOnScreen=false;
function needsFrame(){ return (cloudOnScreen&&window.innerWidth>=1024)||lightbox.classList.contains('active'); }
function wakeFrame(){ if(frameRaf===null&&document.getElementById('realisations').classList.contains('active')) frameRaf=requestAnimationFrame(frame); }
if(floatingCloudBtn&&'IntersectionObserver' in window){
new IntersectionObserver(function(entries){ cloudOnScreen=entries[0].isIntersecting; if(cloudOnScreen) wakeFrame(); }).observe(floatingCloudBtn);
} else cloudOnScreen=true;
window.addEventListener('resize',wakeFrame);
root.querySelector('#gallery-root').addEventListener('click',function(){ setTimeout(wakeFrame,0); });
frameRaf=requestAnimationFrame(frame);
Anim.realisations={
start:function(){ if(frameRaf===null) frameRaf=requestAnimationFrame(frame); },
start:function(){ wakeFrame(); },
stop:function(){ if(frameRaf!==null){ cancelAnimationFrame(frameRaf); frameRaf=null; } }
};
var cloudWrapper=root.querySelector('#cloudWrapper'); var galleryMaster=root.querySelector('#galleryMaster');