/* Repris du site de Chezlepro (site-web-chezlepro, js/site.js) : le ciel étoilé, les apparitions au défilement, l'adresse avalée par la 404. */ (function(){ var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; /* ---------- constellation ---------- */ var sky = document.querySelector('#sky canvas'); if(sky){ var ctx = sky.getContext('2d'), W, H, DPR, stars=[], raf; function size(){ DPR = Math.min(window.devicePixelRatio||1, 2); W = sky.clientWidth; H = sky.clientHeight; sky.width = W*DPR; sky.height = H*DPR; ctx.setTransform(DPR,0,0,DPR,0,0); var count = Math.min(120, Math.round(W*H/14000)); stars = []; for(var i=0;iW)s.x-=W; if(s.y<0)s.y+=H; if(s.y>H)s.y-=H; } var a = 0.5 + Math.sin(s.tw)*0.4; ctx.beginPath(); ctx.arc(s.x,s.y,s.r,0,6.2832); ctx.fillStyle='rgba(207,230,255,'+a.toFixed(3)+')'; ctx.fill(); } for(var i=0;i