synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
22
README.md
22
README.md
@@ -1,3 +1,21 @@
|
|||||||
# ploxion-implant
|
# 👁 Implant
|
||||||
|
|
||||||
PLOXION · L'implant de vision du futur : le monde devient gris et tu vois les shadows de ce qui peut arriver — les possibilités des univers parallèles. · fournit: implant, futur, shadows, veille
|
L'implant de vision du futur : le monde devient gris et tu vois les shadows de ce qui peut arriver — les possibilités des univers parallèles.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `implant` |
|
||||||
|
| fournit | `implant` `futur` `shadows` `veille` |
|
||||||
|
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSGame` `jOSMobile` `jOSOp` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/implant/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=implant — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre implant` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||||
|
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||||
|
|
||||||
|
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||||
|
|
||||||
|
© 2026 chill-tekk · ne pas nuire
|
||||||
|
|||||||
347
app.blade.php
Normal file
347
app.blade.php
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
{{-- PL0XI0N implant 👁 — implant de vision du futur : voir LES POSSIBILITÉS DES AUTRES UNIVERS PARALLÈLES.
|
||||||
|
OneNote 2020 (Devices → Implant de vision du futur) : « C'est un implant qui se met dans le cerveau et qui permet
|
||||||
|
au porteur de voir un peu dans le futur. En soit il ne voit pas dans l'avenir, mais il peut voir LES POSSIBILITÉS
|
||||||
|
DES AUTRES UNIVERS PARALLÈLES. » Rendu : « Quand il est en marche, le jeu devient un peu gris et on peut voir les
|
||||||
|
shadows de ce qui peut arriver. Exemple : si on regarde un oiseau, on va voir notre oiseau en gris foncé, et autour
|
||||||
|
de lui une multitude de copies de lui mais en plus clair et transparent. » --}}
|
||||||
|
<style>
|
||||||
|
.px-implant{color:var(--xr-fg,#e8ecf8);font-size:14px;line-height:1.45;-webkit-tap-highlight-color:transparent}
|
||||||
|
.px-implant .imp-card{background:var(--xr-card,#111a30);border:1px solid var(--xr-line,#1b2540);border-radius:12px;padding:12px;margin-bottom:12px;transition:opacity .5s}
|
||||||
|
.px-implant h3{margin:0 0 8px;font-size:14px;letter-spacing:.04em}
|
||||||
|
.px-implant .imp-muted{color:var(--xr-muted,#7f93c8);font-size:12px}
|
||||||
|
.px-implant canvas{display:block;width:100%;border-radius:10px;border:1px solid var(--xr-line,#1b2540);touch-action:manipulation;background:var(--xr-bg,#0a0d16)}
|
||||||
|
.px-implant .imp-btn{display:block;width:100%;margin-top:10px;padding:14px 12px;font-size:16px;font-weight:700;border-radius:12px;border:1px solid var(--xr-line,#1b2540);background:var(--xr-accent,#4f7cff);color:#fff;cursor:pointer;transition:transform .12s,opacity .3s}
|
||||||
|
.px-implant .imp-btn:active{transform:scale(.97)}
|
||||||
|
.px-implant.ion .imp-btn{background:#3a3f4a;color:#d8dbe2}
|
||||||
|
.px-implant.ion .imp-card{border-color:#2a2e38}
|
||||||
|
.px-implant .imp-state{margin-top:8px;text-align:center;font-size:12px;color:var(--xr-muted,#7f93c8);min-height:16px}
|
||||||
|
.px-implant.ion .imp-state{color:#b8bdc9}
|
||||||
|
.px-implant .imp-ghosts{display:grid;grid-template-columns:1fr;gap:8px}
|
||||||
|
@media(min-width:560px){.px-implant .imp-ghosts{grid-template-columns:repeat(3,1fr)}}
|
||||||
|
.px-implant .imp-ghost{border:1px dashed var(--xr-muted,#7f93c8);border-radius:10px;padding:10px;background:transparent;color:var(--xr-fg,#e8ecf8);text-align:left;opacity:.55;cursor:pointer;transition:opacity .25s,transform .12s;width:100%}
|
||||||
|
.px-implant .imp-ghost:active{transform:scale(.97)}
|
||||||
|
.px-implant .imp-ghost:hover,.px-implant.ion .imp-ghost{opacity:.9}
|
||||||
|
.px-implant .imp-ghost .g-kind{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:var(--xr-muted,#7f93c8)}
|
||||||
|
.px-implant .imp-ghost .g-name{font-weight:700;margin:2px 0;font-size:14px}
|
||||||
|
.px-implant .imp-ghost .g-why{font-size:11px;color:var(--xr-muted,#7f93c8)}
|
||||||
|
.px-implant .imp-lore p{margin:6px 0}
|
||||||
|
.px-implant .imp-quote{border-left:3px solid var(--xr-accent,#4f7cff);padding:6px 10px;margin:8px 0;background:rgba(127,147,200,.06);border-radius:0 8px 8px 0;font-style:italic}
|
||||||
|
.px-implant .imp-q{display:flex;gap:8px;align-items:baseline;margin:4px 0}
|
||||||
|
.px-implant .imp-q .q-dot{color:var(--xr-accent,#4f7cff)}
|
||||||
|
.px-implant .imp-tip{font-size:11px;color:var(--xr-muted,#7f93c8);margin-top:6px;text-align:center}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var STEAM_ORDER = ['guard','partner','pay','appid','depot','steamcmd','upload','live','store','price','iarc','privacy','firewall','review','release'];
|
||||||
|
var STEAM_LABELS = {
|
||||||
|
guard: 'Activer Steam Guard Mobile', partner: 'Créer le compte partenaire', pay: 'Payer les 100 USD Steam Direct',
|
||||||
|
appid: 'Récupérer l\'App ID', depot: 'Créer + rattacher le dépôt', steamcmd: 'Compte steamcmd (Publish)',
|
||||||
|
upload: 'Uploader le build', live: 'Set build live (beta)', store: 'Remplir la page store', price: 'Régler le prix (2 CHF)',
|
||||||
|
iarc: 'Questionnaire IARC', privacy: 'Privacy policy + collecte', firewall: 'Firewall + TLS partout',
|
||||||
|
review: 'Submit for review', release: 'Release 🚀'
|
||||||
|
};
|
||||||
|
|
||||||
|
function esc(s) {
|
||||||
|
try { if (window.jOSb && window.jOSb.esc) return window.jOSb.esc(s); } catch (e) {}
|
||||||
|
var d = document.createElement('div'); d.textContent = s == null ? '' : s; return d.innerHTML;
|
||||||
|
}
|
||||||
|
function pmeta(id) {
|
||||||
|
try { var l = window.__PLOXIONS__ || []; for (var i = 0; i < l.length; i++) if (l[i].id === id) return l[i]; } catch (e) {}
|
||||||
|
return { id: id, name: id, icon: '▣' };
|
||||||
|
}
|
||||||
|
function launch(id) {
|
||||||
|
try { if (window.jOSOp && window.jOSOp.openPloxion) { var r = window.jOSOp.openPloxion(id); if (r && r.ok) return; } } catch (e) {}
|
||||||
|
try { if (window.jOSMobile && window.jOSMobile.open) { if (window.jOSMobile.open(id)) return; } } catch (e) {}
|
||||||
|
try { if (window.jOS && window.jOS.openPloxion) { window.jOS.openPloxion(id); return; } } catch (e) {}
|
||||||
|
location.href = '/local#px=' + encodeURIComponent(id);
|
||||||
|
}
|
||||||
|
// pseudo-aléa DÉTERMINISTE (pas de Math.random : mêmes oiseaux à chaque boot)
|
||||||
|
function dr(i) { var x = Math.sin(i * 127.1 + 311.7) * 43758.5453; return x - Math.floor(x); }
|
||||||
|
|
||||||
|
// ----- shadows de TES futurs -----
|
||||||
|
function steamShadow() {
|
||||||
|
try {
|
||||||
|
var raw = localStorage.getItem('jos:steam-quest'); if (!raw) return null;
|
||||||
|
var done = JSON.parse(raw) || {};
|
||||||
|
for (var i = 0; i < STEAM_ORDER.length; i++) {
|
||||||
|
var id = STEAM_ORDER[i];
|
||||||
|
if (!done[id]) return { kind: 'Mission Steam · t+1', name: STEAM_LABELS[id] || id, why: 'ta prochaine étape la plus probable', act: 'steam-quest' };
|
||||||
|
}
|
||||||
|
return { kind: 'Mission Steam', name: 'Tout est coché 🎉', why: 'cet univers-là est déjà le tien', act: 'steam-quest' };
|
||||||
|
} catch (e) { return null; }
|
||||||
|
}
|
||||||
|
function topShadows() {
|
||||||
|
var arr = [];
|
||||||
|
try {
|
||||||
|
var G = window.jOSGame, op = null;
|
||||||
|
if (G && G.state) { var st = G.state() || {}; op = st.opened || null; }
|
||||||
|
if (!op && G && G.counts) op = G.counts() || null;
|
||||||
|
if (op) {
|
||||||
|
for (var k in op) if (Object.prototype.hasOwnProperty.call(op, k)) arr.push([k, +op[k] || 1]);
|
||||||
|
arr.sort(function (a, b) { return b[1] - a[1]; });
|
||||||
|
arr = arr.slice(0, 3).map(function (e) {
|
||||||
|
var m = pmeta(e[0]);
|
||||||
|
return { kind: 'univers fréquent', name: (m.icon || '▣') + ' ' + (m.name || e[0]), why: 'ouvert ' + e[1] + '×, tu vas probablement y retourner', act: e[0] };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) { arr = []; }
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
function pokedexShadow() {
|
||||||
|
try {
|
||||||
|
var raw = localStorage.getItem('jos:pokedex'); if (!raw) return null;
|
||||||
|
var d = JSON.parse(raw), list = null;
|
||||||
|
if (Array.isArray(d)) list = d;
|
||||||
|
else if (d && Array.isArray(d.powers)) list = d.powers;
|
||||||
|
else if (d && Array.isArray(d.list)) list = d.list;
|
||||||
|
if (list) {
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
var it = list[i];
|
||||||
|
if (it && typeof it === 'object' && !(it.owned || it.caught || it.done || it.unlocked)) {
|
||||||
|
return { kind: 'pouvoir manquant', name: it.name || it.label || it.id || ('pouvoir #' + (i + 1)), why: 'un futur où tu l\'as attrapé existe déjà', act: 'pokedex' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (d && typeof d === 'object') {
|
||||||
|
var m = (d.owned && typeof d.owned === 'object') ? d.owned : d;
|
||||||
|
for (var k in m) if (Object.prototype.hasOwnProperty.call(m, k) && !m[k]) {
|
||||||
|
return { kind: 'pouvoir manquant', name: k, why: 'un futur où tu l\'as attrapé existe déjà', act: 'pokedex' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function describe() {
|
||||||
|
var on = false, act = 0;
|
||||||
|
try { var s = JSON.parse(localStorage.getItem('jos:implant')); if (s) { on = !!s.on; act = +s.activations || 0; } } catch (e) {}
|
||||||
|
return { v: 1, id: 'implant', title: 'Implant', icon: '👁', items: [
|
||||||
|
{ p: 1, kind: 'stat', label: 'implant', value: on ? 'actif' : 'inactif' },
|
||||||
|
{ p: 2, kind: 'stat', label: 'activations', value: act }
|
||||||
|
] };
|
||||||
|
}
|
||||||
|
function mount(container, ctx) {
|
||||||
|
var root = document.createElement('div');
|
||||||
|
root.className = 'px-implant';
|
||||||
|
container.innerHTML = '';
|
||||||
|
container.appendChild(root);
|
||||||
|
|
||||||
|
// --- état persisté ---
|
||||||
|
var state = { on: false, activations: 0 };
|
||||||
|
try { var raw = localStorage.getItem('jos:implant'); if (raw) { var s = JSON.parse(raw); if (s && typeof s === 'object') { state.on = !!s.on; state.activations = +s.activations || 0; } } } catch (e) {}
|
||||||
|
function save() {
|
||||||
|
try { localStorage.setItem('jos:implant', JSON.stringify(state)); } catch (e) {}
|
||||||
|
try { if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon('implant', state); } catch (e) {}
|
||||||
|
}
|
||||||
|
try { if (window.jOSBoxion && window.jOSBoxion.load) window.jOSBoxion.load('implant').then(function (d) { if (d && typeof d === 'object' && !localStorage.getItem('jos:implant')) { state.on = !!d.on; state.activations = +d.activations || 0; syncUI(); } }).catch(function () {}); } catch (e) {}
|
||||||
|
|
||||||
|
var reduced = false;
|
||||||
|
try { reduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; } catch (e) {}
|
||||||
|
|
||||||
|
// --- shadows de tes futurs ---
|
||||||
|
var shadows = [];
|
||||||
|
var sst = steamShadow(); if (sst) shadows.push(sst);
|
||||||
|
shadows = shadows.concat(topShadows());
|
||||||
|
var pk = pokedexShadow(); if (pk) shadows.push(pk);
|
||||||
|
if (!shadows.length) shadows.push({ kind: 'brouillard', name: 'Aucune shadow pour l\'instant', why: 'ouvre des ploxions : l\'implant a besoin de te connaître pour extrapoler tes futurs', act: 'hud' });
|
||||||
|
|
||||||
|
var ghostHtml = shadows.map(function (g, i) {
|
||||||
|
return '<button class="imp-ghost" data-act="' + esc(g.act) + '" data-i="' + i + '">'
|
||||||
|
+ '<div class="g-kind">👁 ' + esc(g.kind) + '</div>'
|
||||||
|
+ '<div class="g-name">' + esc(g.name) + '</div>'
|
||||||
|
+ '<div class="g-why">' + esc(g.why) + '</div>'
|
||||||
|
+ '</button>';
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
root.innerHTML =
|
||||||
|
'<div class="imp-card">'
|
||||||
|
+ '<h3>👁 Implant de vision du futur</h3>'
|
||||||
|
+ '<div class="imp-muted">Il ne voit pas l\'avenir. Il voit <b>les possibilités des autres univers parallèles</b>. Touche un oiseau pour le suivre.</div>'
|
||||||
|
+ '<canvas class="imp-cv" style="margin-top:10px"></canvas>'
|
||||||
|
+ '<button class="imp-btn" type="button">👁 activer l\'implant</button>'
|
||||||
|
+ '<div class="imp-state"></div>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '<div class="imp-card">'
|
||||||
|
+ '<h3>👤 L\'implant sur TOI</h3>'
|
||||||
|
+ '<div class="imp-muted" style="margin-bottom:8px">Tes propres shadows : ce que tu fais probablement dans les univers d\'à côté. Touche une shadow pour la rejoindre.</div>'
|
||||||
|
+ '<div class="imp-ghosts">' + ghostHtml + '</div>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '<div class="imp-card imp-lore">'
|
||||||
|
+ '<h3>📜 Fiche (Protagonistes, 2020)</h3>'
|
||||||
|
+ '<p>Inventé par <b>un RS d\'un univers parallèle</b> — un homme qui a tout perdu et qui souffre de ses échecs. Il voulait ne plus jamais rater un embranchement.</p>'
|
||||||
|
+ '<div class="imp-quote">« Quand je marchais dans la rue, je m\'imaginais ce que les gens pouvaient faire, leurs possibilités de mouvement. »</div>'
|
||||||
|
+ '<p class="imp-muted">Questions de recherche (encore ouvertes dans le doc) :</p>'
|
||||||
|
+ '<div class="imp-q"><span class="q-dot">◆</span><span>Le <b>son</b> ? Entend-on aussi les futurs possibles, ou seulement leurs shadows ?</span></div>'
|
||||||
|
+ '<div class="imp-q"><span class="q-dot">◆</span><span>La <b>précision</b> ? Plus on regarde loin (t+1s, t+10s…), plus les copies se dispersent — jusqu\'où reste-t-il un signal ?</span></div>'
|
||||||
|
+ '<div class="imp-q"><span class="q-dot">◆</span><span>L\'<b>énergie</b> ? Voir tous les possibles a un coût. Qui le paie, et en quoi ?</span></div>'
|
||||||
|
+ '<p class="imp-tip">Certains disent qu\'un univers voisin est né d\'un seul instant qui a mal tourné. Personne ne sait lequel.</p>'
|
||||||
|
+ '</div>';
|
||||||
|
|
||||||
|
var cv = root.querySelector('.imp-cv');
|
||||||
|
var btn = root.querySelector('.imp-btn');
|
||||||
|
var stateLine = root.querySelector('.imp-state');
|
||||||
|
var g2d = cv.getContext('2d');
|
||||||
|
|
||||||
|
// --- oiseaux (boids simplifiés, déterministes) ---
|
||||||
|
var W = 300, H = 240, DPR = Math.min(window.devicePixelRatio || 1, 2);
|
||||||
|
var N = 7, birds = [];
|
||||||
|
for (var i = 0; i < N; i++) {
|
||||||
|
birds.push({
|
||||||
|
x: 30 + dr(i) * 240, y: 30 + dr(i + 50) * 180,
|
||||||
|
ang: dr(i + 100) * Math.PI * 2,
|
||||||
|
spd: 34 + dr(i + 150) * 26,
|
||||||
|
freq: 0.5 + dr(i + 200) * 0.9,
|
||||||
|
phase: dr(i + 250) * Math.PI * 2,
|
||||||
|
hue: Math.floor(dr(i + 300) * 360)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var follow = -1, t = 0, raf = 0, last = 0, alive = true;
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
var w = Math.max(240, cv.clientWidth || root.clientWidth || 300);
|
||||||
|
W = w; H = Math.max(200, Math.min(300, Math.round(w * 0.55)));
|
||||||
|
cv.width = Math.round(W * DPR); cv.height = Math.round(H * DPR);
|
||||||
|
cv.style.height = H + 'px';
|
||||||
|
g2d.setTransform(DPR, 0, 0, DPR, 0, 0);
|
||||||
|
}
|
||||||
|
resize();
|
||||||
|
var onWinResize = function () { resize(); };
|
||||||
|
window.addEventListener('resize', onWinResize);
|
||||||
|
|
||||||
|
function wrap(b) {
|
||||||
|
if (b.x < -12) b.x = W + 12; if (b.x > W + 12) b.x = -12;
|
||||||
|
if (b.y < -12) b.y = H + 12; if (b.y > H + 12) b.y = -12;
|
||||||
|
}
|
||||||
|
function futurePos(b, dt, dAng) {
|
||||||
|
var a = b.ang + dAng;
|
||||||
|
return { x: b.x + Math.cos(a) * b.spd * dt, y: b.y + Math.sin(a) * b.spd * dt, a: a };
|
||||||
|
}
|
||||||
|
function tri(x, y, a, r, fill, stroke) {
|
||||||
|
g2d.save(); g2d.translate(x, y); g2d.rotate(a);
|
||||||
|
g2d.beginPath();
|
||||||
|
g2d.moveTo(r, 0); g2d.lineTo(-r * 0.7, r * 0.55); g2d.lineTo(-r * 0.35, 0); g2d.lineTo(-r * 0.7, -r * 0.55);
|
||||||
|
g2d.closePath();
|
||||||
|
g2d.fillStyle = fill; g2d.fill();
|
||||||
|
if (stroke) { g2d.strokeStyle = stroke; g2d.lineWidth = 1; g2d.stroke(); }
|
||||||
|
g2d.restore();
|
||||||
|
}
|
||||||
|
var GHOSTS = [
|
||||||
|
{ dt: 0.5, da: -Math.PI / 12 }, { dt: 0.5, da: Math.PI / 12 },
|
||||||
|
{ dt: 1.0, da: -Math.PI / 6 }, { dt: 1.0, da: 0 }, { dt: 1.0, da: Math.PI / 6 }
|
||||||
|
];
|
||||||
|
function draw() {
|
||||||
|
var on = state.on;
|
||||||
|
g2d.clearRect(0, 0, W, H);
|
||||||
|
g2d.fillStyle = on ? '#15161a' : '#0a0d16';
|
||||||
|
g2d.fillRect(0, 0, W, H);
|
||||||
|
// petites étoiles fixes (déterministes, pas d'anim = GPU-cheap)
|
||||||
|
g2d.fillStyle = on ? 'rgba(200,205,215,.10)' : 'rgba(127,147,200,.16)';
|
||||||
|
for (var s = 0; s < 22; s++) g2d.fillRect(dr(s + 400) * W, dr(s + 440) * H, 1.6, 1.6);
|
||||||
|
for (var i = 0; i < birds.length; i++) {
|
||||||
|
var b = birds[i], sel = (i === follow);
|
||||||
|
if (on) {
|
||||||
|
for (var gI = 0; gI < GHOSTS.length; gI++) {
|
||||||
|
var gh = GHOSTS[gI], p = futurePos(b, gh.dt, gh.da);
|
||||||
|
var al = (gh.dt < 0.75 ? 0.30 : 0.16) * (sel ? 1.6 : 1);
|
||||||
|
if (sel) {
|
||||||
|
g2d.strokeStyle = 'rgba(220,224,232,' + (al * 0.5) + ')';
|
||||||
|
g2d.lineWidth = 1; g2d.beginPath(); g2d.moveTo(b.x, b.y); g2d.lineTo(p.x, p.y); g2d.stroke();
|
||||||
|
}
|
||||||
|
tri(p.x, p.y, p.a, sel ? 9 : 8, 'rgba(225,228,236,' + Math.min(al, 0.55) + ')', null);
|
||||||
|
}
|
||||||
|
tri(b.x, b.y, b.ang, sel ? 11 : 9, '#3a3f4a', sel ? '#d8dbe2' : '#565c68');
|
||||||
|
} else {
|
||||||
|
tri(b.x, b.y, b.ang, sel ? 11 : 9, 'hsl(' + b.hue + ',70%,62%)', sel ? '#fff' : null);
|
||||||
|
}
|
||||||
|
if (sel) {
|
||||||
|
g2d.strokeStyle = on ? 'rgba(216,219,226,.7)' : 'rgba(255,255,255,.7)';
|
||||||
|
g2d.lineWidth = 1.2; g2d.beginPath(); g2d.arc(b.x, b.y, 16, 0, Math.PI * 2); g2d.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function step(now) {
|
||||||
|
if (!alive) return;
|
||||||
|
raf = requestAnimationFrame(step);
|
||||||
|
if (!last) last = now;
|
||||||
|
var dt = Math.min(0.05, (now - last) / 1000); last = now;
|
||||||
|
if (reduced) dt *= 0.35;
|
||||||
|
t += dt;
|
||||||
|
for (var i = 0; i < birds.length; i++) {
|
||||||
|
var b = birds[i];
|
||||||
|
b.ang += Math.sin(t * b.freq + b.phase) * 0.9 * dt;
|
||||||
|
b.x += Math.cos(b.ang) * b.spd * dt;
|
||||||
|
b.y += Math.sin(b.ang) * b.spd * dt;
|
||||||
|
wrap(b);
|
||||||
|
}
|
||||||
|
draw();
|
||||||
|
}
|
||||||
|
raf = requestAnimationFrame(step);
|
||||||
|
|
||||||
|
// --- interactions ---
|
||||||
|
function syncUI() {
|
||||||
|
root.classList.toggle('ion', state.on);
|
||||||
|
btn.textContent = state.on ? '👁 désactiver l\'implant' : '👁 activer l\'implant';
|
||||||
|
stateLine.textContent = state.on
|
||||||
|
? 'implant actif — le monde devient gris, les shadows des possibles apparaissent'
|
||||||
|
: 'implant éteint — un seul univers à la fois';
|
||||||
|
}
|
||||||
|
syncUI();
|
||||||
|
|
||||||
|
var onBtn = function () {
|
||||||
|
state.on = !state.on;
|
||||||
|
if (state.on) {
|
||||||
|
state.activations++;
|
||||||
|
try { if (window.jOSGame && window.jOSGame.event) window.jOSGame.event('implant.on', { n: state.activations }); } catch (e) {}
|
||||||
|
if (state.activations === 1) {
|
||||||
|
try { if (window.jOSGame && window.jOSGame.award) window.jOSGame.award('px:implant:vision', { label: 'Vision parallèle', icon: '👁', toast: true }); } catch (e) {}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try { if (window.jOSGame && window.jOSGame.event) window.jOSGame.event('implant.off', {}); } catch (e) {}
|
||||||
|
}
|
||||||
|
save(); syncUI();
|
||||||
|
};
|
||||||
|
btn.addEventListener('click', onBtn);
|
||||||
|
|
||||||
|
var onCv = function (ev) {
|
||||||
|
var r = cv.getBoundingClientRect();
|
||||||
|
var px = (ev.clientX - r.left) * (W / r.width);
|
||||||
|
var py = (ev.clientY - r.top) * (H / r.height);
|
||||||
|
var best = -1, bd = 40 * 40;
|
||||||
|
for (var i = 0; i < birds.length; i++) {
|
||||||
|
var dx = birds[i].x - px, dy = birds[i].y - py, d = dx * dx + dy * dy;
|
||||||
|
if (d < bd) { bd = d; best = i; }
|
||||||
|
}
|
||||||
|
follow = (best === follow) ? -1 : best;
|
||||||
|
if (follow >= 0) { try { if (window.jOSb && window.jOSb.toast) window.jOSb.toast('👁 tu suis cet oiseau'); } catch (e) {} }
|
||||||
|
};
|
||||||
|
cv.addEventListener('pointerdown', onCv);
|
||||||
|
|
||||||
|
var onGhost = function (ev) {
|
||||||
|
var el = ev.target.closest ? ev.target.closest('.imp-ghost') : null;
|
||||||
|
if (!el) return;
|
||||||
|
var act = el.getAttribute('data-act');
|
||||||
|
try { if (window.jOSGame && window.jOSGame.event) window.jOSGame.event('implant.jump', { to: act }); } catch (e) {}
|
||||||
|
if (act) launch(act);
|
||||||
|
};
|
||||||
|
root.addEventListener('click', onGhost);
|
||||||
|
|
||||||
|
return {
|
||||||
|
unmount: function () {
|
||||||
|
alive = false;
|
||||||
|
if (raf) cancelAnimationFrame(raf);
|
||||||
|
window.removeEventListener('resize', onWinResize);
|
||||||
|
btn.removeEventListener('click', onBtn);
|
||||||
|
cv.removeEventListener('pointerdown', onCv);
|
||||||
|
root.removeEventListener('click', onGhost);
|
||||||
|
container.innerHTML = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
window.jOSApps['implant'] = { manifest: { id: 'implant', name: 'Implant', icon: '👁' }, mount: mount, describe: describe };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user