reowrked the static/standalone version and migrated to cloudflare pages
This commit is contained in:
1 parent
49c79b31a9
commit
9442868a8b
7 files changed
+131
-39
No files matched your search
+21
-12
@@ -184,6 +184,8 @@ footer{padding:40px clamp(20px,6vw,120px);font-size:13px;color:var(--muted);disp
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<noscript><style>body{cursor:auto}.rv{opacity:1!important}</style></noscript>
|
||||
|
||||
<canvas id="scene" aria-hidden="true"></canvas>
|
||||
<div class="grain" aria-hidden="true"></div>
|
||||
<div class="vignette" aria-hidden="true"></div>
|
||||
@@ -369,7 +371,7 @@ footer{padding:40px clamp(20px,6vw,120px);font-size:13px;color:var(--muted);disp
|
||||
<a data-mag href="tel:+41799068253">+41 79 906 82 53</a>
|
||||
<a data-mag href="https://github.com/Quinta0" target="_blank" rel="noopener">GitHub</a>
|
||||
<a data-mag href="https://linkedin.com/in/pietro-quintavalle" target="_blank" rel="noopener">LinkedIn</a>
|
||||
<a data-mag href="https://quinta0.github.io/whoami" target="_blank" rel="noopener">whoami</a>
|
||||
<a data-mag href="__NEW_URL__" target="_blank" rel="noopener">whoami</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -387,16 +389,20 @@ const isMobile = coarse || innerWidth < 760;
|
||||
|
||||
/* ---------- Three.js particle sculpture ---------- */
|
||||
const canvas = document.getElementById('scene');
|
||||
const hasThree = typeof THREE !== 'undefined';
|
||||
let renderer;
|
||||
try { renderer = new THREE.WebGLRenderer({canvas, antialias:false, alpha:true, powerPreference:'high-performance'}); }
|
||||
catch(e){ canvas.style.display='none'; }
|
||||
if (hasThree) {
|
||||
try { renderer = new THREE.WebGLRenderer({canvas, antialias:false, alpha:true, powerPreference:'high-performance'}); }
|
||||
catch(e){}
|
||||
}
|
||||
if (!renderer) canvas.style.display = 'none';
|
||||
|
||||
const COUNT = isMobile ? 6000 : 15000;
|
||||
const scene = new THREE.Scene();
|
||||
const camera = new THREE.PerspectiveCamera(42, innerWidth/innerHeight, 0.1, 100);
|
||||
camera.position.set(0, 0, 18);
|
||||
const group = new THREE.Group();
|
||||
scene.add(group);
|
||||
const scene = hasThree ? new THREE.Scene() : null;
|
||||
const camera = hasThree ? new THREE.PerspectiveCamera(42, innerWidth/innerHeight, 0.1, 100) : null;
|
||||
const group = hasThree ? new THREE.Group() : null;
|
||||
if (camera) camera.position.set(0, 0, 18);
|
||||
if (scene && group) scene.add(group);
|
||||
|
||||
const rnd = (a=1,b=0)=>Math.random()*(a-b)+b;
|
||||
|
||||
@@ -635,6 +641,7 @@ let hoverT=0, hoverCur=0, swapCur=1, hoverKey=null, hoverLabel=null;
|
||||
let progT=0, progCur=0, keyEls=null;
|
||||
let scrollT=0, scrollCur=0, mx=0,my=0, mxCur=0,myCur=0, mouseOn=0, mouseOnCur=0;
|
||||
function updateScroll(){
|
||||
if(!hasThree)return;
|
||||
const max=document.documentElement.scrollHeight-innerHeight; scrollT=max>0?scrollY/max:0;
|
||||
if(!keyEls) keyEls=['.hero','#work','#skills','#contact'].map(q=>document.querySelector(q));
|
||||
const c=keyEls.map(el=>el.offsetTop+el.offsetHeight/2-innerHeight/2), y=scrollY;
|
||||
@@ -647,8 +654,11 @@ addEventListener('pointermove',e=>{ mx=(e.clientX/innerWidth)*2-1; my=-(e.client
|
||||
addEventListener('pointerleave',()=>{mouseOn=0});
|
||||
document.addEventListener('mouseleave',()=>{mouseOn=0});
|
||||
|
||||
const plane=new THREE.Plane(new THREE.Vector3(0,0,1),0), ray=new THREE.Raycaster(), hit=new THREE.Vector3(), ndc=new THREE.Vector2();
|
||||
const clock=new THREE.Clock();
|
||||
const plane = hasThree ? new THREE.Plane(new THREE.Vector3(0,0,1),0) : null;
|
||||
const ray = hasThree ? new THREE.Raycaster() : null;
|
||||
const hit = hasThree ? new THREE.Vector3() : null;
|
||||
const ndc = hasThree ? new THREE.Vector2() : null;
|
||||
const clock = hasThree ? new THREE.Clock() : null;
|
||||
let introT=0;
|
||||
|
||||
function frame(){
|
||||
@@ -788,8 +798,7 @@ document.querySelectorAll('nav a[href^="#"]').forEach(a=>a.addEventListener('cli
|
||||
|
||||
/* boot: wait for the display font so the PQ sampling is right, then go */
|
||||
function boot(){
|
||||
if(!renderer)return;
|
||||
buildParticles(); resize(); updateScroll(); frame();
|
||||
if(renderer){ buildParticles(); resize(); updateScroll(); frame(); }
|
||||
setTimeout(()=>name.classList.add('on'),150);
|
||||
}
|
||||
if(document.fonts&&document.fonts.load){ Promise.race([document.fonts.load('800 300px Syne'),new Promise(r=>setTimeout(r,1500))]).then(boot,boot); } else boot();
|
||||
|
||||
Reference in new issue
Block a user