feat: first working version
This commit is contained in:
BIN
ambiant.mp3
Normal file
BIN
ambiant.mp3
Normal file
Binary file not shown.
56
index.html
56
index.html
@@ -149,7 +149,11 @@ body {
|
|||||||
#timer-num { font-size: .95rem; color: #ffe066; font-weight: 900; min-width: 28px; text-align: right; transition: color .35s; }
|
#timer-num { font-size: .95rem; color: #ffe066; font-weight: 900; min-width: 28px; text-align: right; transition: color .35s; }
|
||||||
|
|
||||||
@keyframes timerPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }
|
@keyframes timerPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }
|
||||||
#timer-num.urgent { color: #FF2255; animation: timerPulse .45s ease-in-out infinite; }
|
@keyframes timerBarBlink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
|
||||||
|
#timer-num.warn { color: #FF2255; animation: timerPulse .55s ease-in-out infinite; }
|
||||||
|
#timer-num.urgent { color: #FF2255; animation: timerPulse .28s ease-in-out infinite; }
|
||||||
|
#timer-fill.urgent { animation: timerBarBlink .28s ease-in-out infinite; }
|
||||||
|
#timer-wrap.urgent { filter: drop-shadow(0 0 10px rgba(255,34,85,.75)); }
|
||||||
|
|
||||||
/* ── No-Queen button ── */
|
/* ── No-Queen button ── */
|
||||||
#no-queen-btn {
|
#no-queen-btn {
|
||||||
@@ -366,7 +370,8 @@ body {
|
|||||||
// Config
|
// Config
|
||||||
// ─────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────
|
||||||
const CFG = {
|
const CFG = {
|
||||||
NUM_BEES: 2500,
|
NUM_BEES_MIN: 500, // abeilles au 1er cadre
|
||||||
|
NUM_BEES_MAX: 2500, // abeilles au dernier cadre (progression linéaire)
|
||||||
BEE_SPEED: 0.35, // multiplicateur global de vitesse (1.0 = vitesse d'origine)
|
BEE_SPEED: 0.35, // multiplicateur global de vitesse (1.0 = vitesse d'origine)
|
||||||
BEE_SCALE: 0.20, // taille des abeilles (1.0 = taille d'origine)
|
BEE_SCALE: 0.20, // taille des abeilles (1.0 = taille d'origine)
|
||||||
|
|
||||||
@@ -705,6 +710,7 @@ const G = (() => {
|
|||||||
const elScore = document.getElementById('h-score');
|
const elScore = document.getElementById('h-score');
|
||||||
const elTimerF = document.getElementById('timer-fill');
|
const elTimerF = document.getElementById('timer-fill');
|
||||||
const elTimerN = document.getElementById('timer-num');
|
const elTimerN = document.getElementById('timer-num');
|
||||||
|
const elTimerW = document.getElementById('timer-wrap');
|
||||||
|
|
||||||
// ── Screen helpers ──
|
// ── Screen helpers ──
|
||||||
function enterGame() {
|
function enterGame() {
|
||||||
@@ -731,10 +737,15 @@ const G = (() => {
|
|||||||
|
|
||||||
function timerUI() {
|
function timerUI() {
|
||||||
const pct = timeLeft / CFG.FRAME_SECS;
|
const pct = timeLeft / CFG.FRAME_SECS;
|
||||||
|
const warn = timeLeft <= 10;
|
||||||
|
const urgent = timeLeft <= 5;
|
||||||
elTimerF.style.width = (pct * 100) + '%';
|
elTimerF.style.width = (pct * 100) + '%';
|
||||||
elTimerF.style.background = pct < .3 ? '#FF2255' : pct < .6 ? '#ffaa00' : '#FFD600';
|
elTimerF.style.background = urgent ? '#FF2255' : warn ? '#ffaa00' : '#FFD600';
|
||||||
elTimerN.textContent = Math.ceil(timeLeft);
|
elTimerN.textContent = Math.ceil(timeLeft);
|
||||||
elTimerN.classList.toggle('urgent', timeLeft < 10);
|
elTimerN.classList.toggle('warn', warn && !urgent);
|
||||||
|
elTimerN.classList.toggle('urgent', urgent);
|
||||||
|
elTimerF.classList.toggle('urgent', urgent);
|
||||||
|
elTimerW.classList.toggle('urgent', urgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Bees ──
|
// ── Bees ──
|
||||||
@@ -742,8 +753,10 @@ const G = (() => {
|
|||||||
bees = []; queen = null;
|
bees = []; queen = null;
|
||||||
hasQueen = Math.random() < CFG.QUEEN_PROB;
|
hasQueen = Math.random() < CFG.QUEEN_PROB;
|
||||||
const W = canvas.width, H = canvas.height;
|
const W = canvas.width, H = canvas.height;
|
||||||
|
const t = CFG.NUM_FRAMES > 1 ? frameIdx / (CFG.NUM_FRAMES - 1) : 1;
|
||||||
|
const numBees = Math.round(CFG.NUM_BEES_MIN + (CFG.NUM_BEES_MAX - CFG.NUM_BEES_MIN) * t);
|
||||||
|
|
||||||
for (let i = 0; i < CFG.NUM_BEES; i++) {
|
for (let i = 0; i < numBees; i++) {
|
||||||
const type = Math.random() < .9 ? 'worker' : 'drone';
|
const type = Math.random() < .9 ? 'worker' : 'drone';
|
||||||
const layer = (Math.random() * 2) | 0;
|
const layer = (Math.random() * 2) | 0;
|
||||||
bees.push(new Bee(
|
bees.push(new Bee(
|
||||||
@@ -777,20 +790,37 @@ const G = (() => {
|
|||||||
if (!locked) bees.forEach(b => b.update(W, H));
|
if (!locked) bees.forEach(b => b.update(W, H));
|
||||||
bees.forEach(b => b.draw());
|
bees.forEach(b => b.draw());
|
||||||
|
|
||||||
// Queen reveal ring
|
// Queen reveal : spotlight + golden ring
|
||||||
if (reveal) {
|
if (reveal) {
|
||||||
const pulse = .5 + .5 * Math.sin(Date.now() / 130);
|
const pulse = .5 + .5 * Math.sin(Date.now() / 140);
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.strokeStyle = `rgba(255,55,55,${.55 + pulse * .45})`;
|
|
||||||
ctx.lineWidth = 3.5;
|
// Radial vignette — darken everything outside queen zone
|
||||||
|
const grad = ctx.createRadialGradient(reveal.x, reveal.y, 70, reveal.x, reveal.y, Math.max(W, H));
|
||||||
|
grad.addColorStop(0, 'rgba(0,0,0,0)');
|
||||||
|
grad.addColorStop(0.35,'rgba(0,0,0,.55)');
|
||||||
|
grad.addColorStop(1, 'rgba(0,0,0,.82)');
|
||||||
|
ctx.fillStyle = grad;
|
||||||
|
ctx.fillRect(0, 0, W, H);
|
||||||
|
|
||||||
|
// Golden pulsing ring
|
||||||
|
ctx.shadowColor = '#ffd600';
|
||||||
|
ctx.shadowBlur = 20 + pulse * 18;
|
||||||
|
ctx.strokeStyle = `rgba(255,214,0,${.65 + pulse * .35})`;
|
||||||
|
ctx.lineWidth = 4 + pulse * 2;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(reveal.x, reveal.y, 44 + pulse * 9, 0, Math.PI * 2);
|
ctx.arc(reveal.x, reveal.y, 54 + pulse * 10, 0, Math.PI * 2);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
ctx.fillStyle = `rgba(255,55,55,${.7 + pulse * .3})`;
|
ctx.shadowBlur = 0;
|
||||||
ctx.font = 'bold 13px Georgia';
|
|
||||||
|
// Crown label
|
||||||
|
ctx.font = 'bold 900 15px Nunito, sans-serif';
|
||||||
ctx.textAlign = 'center';
|
ctx.textAlign = 'center';
|
||||||
ctx.textBaseline = 'middle';
|
ctx.textBaseline = 'middle';
|
||||||
ctx.fillText('♛ REINE', reveal.x, reveal.y - 58);
|
ctx.shadowColor = 'rgba(0,0,0,.9)';
|
||||||
|
ctx.shadowBlur = 8;
|
||||||
|
ctx.fillStyle = `rgba(255,220,0,${.85 + pulse * .15})`;
|
||||||
|
ctx.fillText('♛ REINE', reveal.x, reveal.y - 75);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
specs spot.pdf
BIN
specs spot.pdf
Binary file not shown.
Reference in New Issue
Block a user