mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-souris.git
synced 2026-11-29 07:15:06 +00:00
46 lines
3.7 KiB
PHP
46 lines
3.7 KiB
PHP
{{-- PL0XI0N Souris — entrée WORMION : visualise le mouvement + les clics dans
|
|
la fenêtre (coords live, traînée, ripples de clic). 100% client-side.
|
|
Droit au silence : unmount retire les écouteurs + l'animation. --}}
|
|
<style>
|
|
.pms{position:relative;height:100%;background:radial-gradient(circle at 50% 40%,#0a1410,#04060a);color:rgba(220,240,235,.92);font-family:ui-sans-serif,system-ui,sans-serif;overflow:hidden;cursor:crosshair;touch-action:none}
|
|
.pms__hint{position:absolute;top:14px;left:0;right:0;text-align:center;font-size:.82rem;color:rgba(180,210,200,.55);pointer-events:none}
|
|
.pms__hud{position:absolute;bottom:12px;left:14px;font-family:'Share Tech Mono',ui-monospace,monospace;font-size:.82rem;color:rgba(0,255,159,.85);pointer-events:none}
|
|
.pms__cursor{position:absolute;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid rgba(0,255,159,.9);border-radius:50%;box-shadow:0 0 12px rgba(0,255,159,.6);pointer-events:none;transition:transform .04s linear}
|
|
.pms__dot{position:absolute;width:6px;height:6px;margin:-3px 0 0 -3px;border-radius:50%;background:rgba(0,200,255,.7);pointer-events:none;animation:pmsfade 1s ease forwards}
|
|
@keyframes pmsfade{from{opacity:.7;transform:scale(1)}to{opacity:0;transform:scale(.3)}}
|
|
.pms__ring{position:absolute;border:2px solid rgba(0,255,159,.8);border-radius:50%;margin:-6px 0 0 -6px;width:12px;height:12px;pointer-events:none;animation:pmsring .5s ease-out forwards}
|
|
@keyframes pmsring{from{opacity:.9;transform:scale(.4)}to{opacity:0;transform:scale(5)}}
|
|
</style>
|
|
<script>
|
|
(function(){
|
|
'use strict';
|
|
var ID='souris';
|
|
var LIVE=null; // posé au mount : { pos }
|
|
function describe(){
|
|
var p=LIVE?LIVE.pos():null;
|
|
return { v:1, id:ID, title:'Souris', icon:'🖱', items:[
|
|
{ p:1, kind:'stat', label:'position', value:p?('x '+Math.round(p.x)+' · y '+Math.round(p.y)):'aucun mouvement' }
|
|
] };
|
|
}
|
|
function mount(container){
|
|
container.innerHTML='<div class="pms" data-root tabindex="0">'
|
|
+'<div class="pms__hint">🖱 Souris — le wormion suit ton geste. Bouge / clique ici.</div>'
|
|
+'<div class="pms__cursor" data-cur style="display:none"></div>'
|
|
+'<div class="pms__hud" data-hud>x — · y — · btn —</div></div>';
|
|
var root=container.querySelector('[data-root]'), cur=container.querySelector('[data-cur]'), hud=container.querySelector('[data-hud]');
|
|
var last=0, lastPos=null;
|
|
function pos(e){ var r=root.getBoundingClientRect(); return {x:e.clientX-r.left,y:e.clientY-r.top}; }
|
|
function onMove(e){ var p=pos(e); lastPos=p; cur.style.display='block'; cur.style.transform='translate('+p.x+'px,'+p.y+'px)';
|
|
hud.textContent='x '+Math.round(p.x)+' · y '+Math.round(p.y)+' · btn '+(e.buttons||'—');
|
|
var now=Date.now(); if(now-last>28){ last=now; var d=document.createElement('div'); d.className='pms__dot'; d.style.left=p.x+'px'; d.style.top=p.y+'px'; root.appendChild(d); setTimeout(function(){d.remove();},1000); } }
|
|
function onDown(e){ var p=pos(e); var r=document.createElement('div'); r.className='pms__ring'; r.style.left=p.x+'px'; r.style.top=p.y+'px'; root.appendChild(r); setTimeout(function(){r.remove();},500); }
|
|
root.addEventListener('pointermove',onMove);
|
|
root.addEventListener('pointerdown',onDown);
|
|
LIVE={ pos:function(){return lastPos;} };
|
|
return { unmount:function(){ LIVE=null; root.removeEventListener('pointermove',onMove); root.removeEventListener('pointerdown',onDown); container.innerHTML=''; } };
|
|
}
|
|
window.jOSApps=window.jOSApps||{};
|
|
window.jOSApps[ID]={manifest:{id:ID,name:'Souris',icon:'🖱'},mount:mount,describe:describe};
|
|
})();
|
|
</script>
|