synchro du labo (0bf0da65) : app.blade.php, README.md

This commit is contained in:
cloudion
2026-11-03 22:42:30 +00:00
commit 9ebef8d4e2
2 changed files with 127 additions and 0 deletions

21
README.md Normal file
View File

@@ -0,0 +1,21 @@
# 🧊 Spherion
Les primitives en 3D, en action : spherion (sphère), cubion (cubes dans cubes), koin (tétraèdre), kion, wormion (tores) — en rotation, drag pour tourner, molette pour zoomer.
| | |
| --- | --- |
| id | `spherion` |
| fournit | — |
| bions qu'il nomme | `jOSApps` |
| fichiers | `app.blade.php` |
| dans le labo | `resources/views/ploxions/spherion/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=spherion — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre spherion` (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

106
app.blade.php Normal file
View File

@@ -0,0 +1,106 @@
{{-- PL0XION spherion — les PRIMITIVES EN 3D, EN ACTION (RS-7 : « continue ces
ploxions et transforme-les en action en 3D »). La sphère = spherion + les autres
primitives en vraie 3D, en rotation : spherion (sphères dans sphères) · cubion
(cubes dans cubes = portion 3D) · koin (tétraèdre) · kion (cube + koins chillés)
· wormion (tores dans tores). Three.js ESM (CSP unpkg). Drag = tourner, molette
= zoomer. window.jOSApps['spherion']. mount(c, ctx) -> { unmount }. --}}
<style>
.s3 { position:relative; height:100%; background:radial-gradient(circle at 50% 40%, rgba(24,20,44,.6), #04050a 80%); overflow:hidden; font-family:ui-sans-serif,system-ui,sans-serif; }
.s3 canvas { display:block; }
.s3__bar { position:absolute; left:10px; top:9px; display:flex; gap:5px; flex-wrap:wrap; z-index:2; }
.s3__m { cursor:pointer; font-size:.66rem; padding:3px 9px; border-radius:7px; border:1px solid rgba(170,150,255,.32); background:rgba(20,16,34,.75); color:rgba(210,195,255,.9); font-family:inherit; }
.s3__m.on { background:rgba(110,75,200,.6); color:#fff; border-color:rgba(190,170,255,.85); }
.s3__hud { position:absolute; right:10px; top:9px; font-size:.66rem; color:rgba(195,185,255,.85); font-family:ui-monospace,monospace; background:rgba(10,8,22,.6); padding:3px 8px; border-radius:7px; pointer-events:none; z-index:2; }
.s3__msg { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:rgba(200,190,235,.6); font-size:.84rem; }
.s3__hint { position:absolute; right:10px; bottom:9px; font-size:.62rem; color:rgba(190,180,225,.6); background:rgba(10,8,22,.6); padding:3px 8px; border-radius:7px; pointer-events:none; z-index:2; }
</style>
<script>
(function () {
var THREE_URL = '/vendor/js/three.module.js';
var MODES = [['spherion', '●', 0xc8a0ff], ['cubion', '▣', 0x6aa6ff], ['koin', '△', 0xff8fc8], ['kion', '▢', 0x9ee6b4], ['wormion', '🌀', 0xb48cff]];
var LIVE = null; // posé au mount : { mode }
function describe() {
var mode = LIVE ? LIVE.mode() : 'spherion';
return { v: 1, id: 'spherion', title: 'Spherion', icon: '🧊', items: [
{ p: 1, kind: 'stat', label: 'primitive 3D', value: mode }
] };
}
function mount(container, ctx) {
var alive = true, raf = 0, ro = null, THREE = null, renderer = null, scene = null, camera = null, grp = null, mode = 'spherion';
LIVE = { mode: function () { return mode; } };
container.innerHTML =
'<div class="s3"><div class="s3__bar">' + MODES.map(function (m, i) { return '<button class="s3__m' + (i === 0 ? ' on' : '') + '" data-m="' + m[0] + '">' + m[1] + ' ' + m[0] + '</button>'; }).join('') + '</div>'
+ '<div class="s3__hud">🧊 primitives 3D</div><div class="s3__hint">drag = tourner · molette = zoom</div>'
+ '<div class="s3__msg">chargement de la 3D…</div></div>';
var root = container.querySelector('.s3'), msg = container.querySelector('.s3__msg');
import(THREE_URL).then(function (T) {
if (!alive) return; THREE = T; msg.remove(); build();
}).catch(function (e) { if (alive) msg.textContent = '3D indisponible (' + (e && e.message || 'erreur') + ')'; });
function wireMesh(geo, color, op) { return new THREE.LineSegments(new THREE.EdgesGeometry(geo), new THREE.LineBasicMaterial({ color: color, transparent: true, opacity: op })); }
function geoWire(geo, color, op) { return new THREE.Mesh(geo, new THREE.MeshBasicMaterial({ color: color, wireframe: true, transparent: true, opacity: op })); }
function solid(geo, color, op) { return new THREE.Mesh(geo, new THREE.MeshStandardMaterial({ color: color, transparent: true, opacity: op, roughness: .45, metalness: .2, flatShading: true })); }
function buildGroup() {
var g = new THREE.Group(), col = (MODES.filter(function (m) { return m[0] === mode; })[0] || [])[2] || 0xc8a0ff;
if (mode === 'spherion') {
for (var i = 0; i < 4; i++) g.add(geoWire(new THREE.IcosahedronGeometry(11 - i * 2.3, 1), col, 0.28 + i * 0.13));
g.add(solid(new THREE.IcosahedronGeometry(3, 1), col, 0.9));
} else if (mode === 'cubion') { // cubes dans cubes = portion en 3D
for (var c = 0; c < 4; c++) { var s = 16 - c * 3.6; g.add(wireMesh(new THREE.BoxGeometry(s, s, s), col, 0.3 + c * 0.16)); }
g.add(solid(new THREE.BoxGeometry(4, 4, 4), col, 0.85));
} else if (mode === 'koin') { // le triangle en 3D = tétraèdre
g.add(solid(new THREE.TetrahedronGeometry(9, 0), col, 0.75));
g.add(wireMesh(new THREE.TetrahedronGeometry(9.2, 0), 0xffffff, 0.5));
} else if (mode === 'kion') { // le cube qui contient/chille des koins
g.add(wireMesh(new THREE.BoxGeometry(15, 15, 15), 0xdfe8ff, 0.85));
var corn = [[-1,-1,-1],[1,-1,1],[-1,1,1],[1,1,-1]];
corn.forEach(function (p) { var k = solid(new THREE.TetrahedronGeometry(3.4, 0), col, 0.85); k.position.set(p[0]*5, p[1]*5, p[2]*5); g.add(k); });
} else { // wormion : tores dans tores
for (var w = 0; w < 4; w++) { var t = geoWire(new THREE.TorusGeometry(11 - w * 2.1, 0.5 + w * 0.15, 8, 36), col, 0.35 + w * 0.13); t.rotation.x = w * 0.5; g.add(t); }
}
return g;
}
function setMode(m) {
mode = m; container.querySelectorAll('.s3__m').forEach(function (b) { b.classList.toggle('on', b.getAttribute('data-m') === m); });
if (!scene) return; if (grp) scene.remove(grp); grp = buildGroup(); scene.add(grp);
}
function build() {
var W = root.clientWidth || 600, H = root.clientHeight || 400;
scene = new THREE.Scene(); scene.fog = new THREE.FogExp2(0x04050a, 0.012);
camera = new THREE.PerspectiveCamera(55, W / H, 0.1, 1000); camera.position.set(0, 0, 42);
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)); renderer.setSize(W, H);
root.appendChild(renderer.domElement);
scene.add(new THREE.AmbientLight(0x99aaff, 0.75));
var dl = new THREE.DirectionalLight(0xffffff, 0.95); dl.position.set(20, 30, 40); scene.add(dl);
grp = buildGroup(); scene.add(grp);
// interaction : drag = rotate, molette = zoom
var drag = false, px = 0, py = 0, vx = 0.006, vy = 0.003;
var cv = renderer.domElement;
cv.style.touchAction = 'none';
cv.addEventListener('pointerdown', function (e) { drag = true; px = e.clientX; py = e.clientY; try { cv.setPointerCapture(e.pointerId); } catch (_) {} });
cv.addEventListener('pointermove', function (e) { if (!drag || !grp) return; grp.rotation.y += (e.clientX - px) * 0.01; grp.rotation.x += (e.clientY - py) * 0.01; px = e.clientX; py = e.clientY; });
cv.addEventListener('pointerup', function () { drag = false; });
cv.addEventListener('wheel', function (e) { e.preventDefault(); camera.position.z = Math.max(14, Math.min(90, camera.position.z * (e.deltaY > 0 ? 1.1 : 0.9))); }, { passive: false });
function loop() { if (!alive) return; if (grp && !drag) { grp.rotation.y += vx; grp.rotation.x += vy; } renderer.render(scene, camera); raf = requestAnimationFrame(loop); }
loop();
ro = new ResizeObserver(function () { var w = root.clientWidth, h = root.clientHeight; if (!w || !h) return; camera.aspect = w / h; camera.updateProjectionMatrix(); renderer.setSize(w, h); });
ro.observe(root);
}
container.querySelector('.s3__bar').addEventListener('click', function (e) { var b = e.target.closest('[data-m]'); if (b) setMode(b.getAttribute('data-m')); });
return { unmount: function () { LIVE = null; alive = false; if (raf) cancelAnimationFrame(raf); try { if (ro) ro.disconnect(); } catch (e) {} try { if (renderer) { renderer.dispose(); renderer.forceContextLoss && renderer.forceContextLoss(); } } catch (e) {} container.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps['spherion'] = { manifest: { id: 'spherion', name: 'Spherion', icon: '🧊' }, mount: mount, describe: describe };
})();
</script>