Spaces:
Running
Running
make the petals multi coloured by layers - Initial Deployment
Browse files- README.md +6 -4
- index.html +146 -18
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: pink
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: happy-combo
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: pink
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,147 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>RFH Intelligent Visualizer</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root { --happiness: 0; }
|
| 9 |
+
body {
|
| 10 |
+
font-family: 'Segoe UI', sans-serif;
|
| 11 |
+
display: flex; justify-content: center; align-items: center;
|
| 12 |
+
min-height: 100vh; margin: 0; padding: 20px;
|
| 13 |
+
transition: background 0.5s ease;
|
| 14 |
+
}
|
| 15 |
+
body.normal {
|
| 16 |
+
background: linear-gradient(
|
| 17 |
+
135deg,
|
| 18 |
+
hsl(calc(200 + var(--happiness) * 1.2), 80%, calc(30% + var(--happiness) * 0.3%)),
|
| 19 |
+
hsl(calc(220 + var(--happiness) * 1.1), 70%, calc(40% + var(--happiness) * 0.4%))
|
| 20 |
+
);
|
| 21 |
+
}
|
| 22 |
+
body.saddest { background: #444; }
|
| 23 |
+
h1 { text-align: center; margin-bottom: 1rem; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
|
| 24 |
+
.container { display: flex; gap: 2rem; max-width: 1000px; width: 100%; }
|
| 25 |
+
.controls, .visuals { flex: 1; }
|
| 26 |
+
.controls {
|
| 27 |
+
background: rgba(255,255,255,0.15); backdrop-filter: blur(10px);
|
| 28 |
+
border-radius: 16px; padding: 2rem; box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
| 29 |
+
}
|
| 30 |
+
.slider-group { margin-bottom: 1.5rem; }
|
| 31 |
+
.label { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
|
| 32 |
+
input[type=range] { width: 100%; height: 8px; appearance: none; background: rgba(255,255,255,0.3); border-radius: 4px; outline: none; }
|
| 33 |
+
input[type=range]:disabled { background: rgba(200,200,200,0.3); }
|
| 34 |
+
input[type=range]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; background: white; border-radius: 50%; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
|
| 35 |
+
select { width: 100%; padding: 0.5rem; border-radius: 8px; border: none; }
|
| 36 |
+
button { width: 100%; padding: 0.75rem; margin-top: 2rem; border: none; border-radius: 8px; background: white; font-size: 1rem; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
|
| 37 |
+
#canvas { width: 100%; height: 240px; margin-top: 1.5rem; }
|
| 38 |
+
.flower-container { position: relative; width: 200px; height: 200px; margin: 1.5rem auto; }
|
| 39 |
+
.flower { position: absolute; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
|
| 40 |
+
.stem { position: absolute; background: linear-gradient(to bottom, #5a8f3d,#3a5e2b); width: 8px; height: 120px; bottom: 0; left: 50%; transform: translateX(-50%); transition: background 0.5s, transform 0.5s; }
|
| 41 |
+
.flower.dead .stem { background: gray; transform: translateX(-50%) rotate(45deg); }
|
| 42 |
+
.flower.saddest .stem { background: black; transform: translateX(-50%) rotate(60deg); }
|
| 43 |
+
.petal { position: absolute; background: currentColor; border-radius: 50% 50% 0 50%; transform-origin: bottom center; opacity: 0; transition: opacity 0.5s ease; }
|
| 44 |
+
.happiness-bar { width: 100%; height: 20px; background: rgba(0,0,0,0.1); border-radius: 10px; overflow: hidden; margin-top: 1rem; }
|
| 45 |
+
.happiness-fill { height: 100%; width: 0%; background: hsl(200,80%,60%); transition: width 0.5s, background 0.5s; }
|
| 46 |
+
</style>
|
| 47 |
+
</head>
|
| 48 |
+
<body class="normal">
|
| 49 |
+
<div class="container">
|
| 50 |
+
<div class="controls">
|
| 51 |
+
<h1>Rich, Boundary & Exposure Experiment</h1>
|
| 52 |
+
<div class="slider-group">
|
| 53 |
+
<div class="label">Money: <span id="RVal">0%</span> (<span id="RAmount">€0</span>)</div>
|
| 54 |
+
<input type="range" id="R" min="0" max="100" step="1" value="0" />
|
| 55 |
+
</div>
|
| 56 |
+
<div class="slider-group">
|
| 57 |
+
<div class="label">Fame: <span id="FVal">0%</span> (<span id="FCount">0</span> ppl)</div>
|
| 58 |
+
<input type="range" id="F" min="0" max="100" step="1" value="0" />
|
| 59 |
+
</div>
|
| 60 |
+
<div class="slider-group">
|
| 61 |
+
<div class="label">Boundaries: <span id="BVal">0.00</span></div>
|
| 62 |
+
<input type="range" id="B" min="0" max="1" step="0.01" value="0" />
|
| 63 |
+
</div>
|
| 64 |
+
<div class="slider-group">
|
| 65 |
+
<div class="label">Jurisdiction</div>
|
| 66 |
+
<select id="jurisdiction">
|
| 67 |
+
<option value="0.6">High Privacy (Cayman)</option>
|
| 68 |
+
<option value="0.7">Mod Privacy (Switzerland)</option>
|
| 69 |
+
<option value="0.8">Low Privacy (EU)</option>
|
| 70 |
+
<option value="1">High Exposure (US)</option>
|
| 71 |
+
</select>
|
| 72 |
+
</div>
|
| 73 |
+
<button id="resetBtn">Reset</button>
|
| 74 |
+
<div class="happiness-bar"><div class="happiness-fill" id="happinessFill"></div></div>
|
| 75 |
+
<div class="flower-container"><div class="flower" id="flower"><div class="stem"></div></div></div>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="visuals"><canvas id="canvas"></canvas></div>
|
| 78 |
+
</div>
|
| 79 |
+
<script>
|
| 80 |
+
const R = document.getElementById('R'), F = document.getElementById('F'), B = document.getElementById('B'), Jur = document.getElementById('jurisdiction');
|
| 81 |
+
const RVal = document.getElementById('RVal'), FVal = document.getElementById('FVal'), BVal = document.getElementById('BVal');
|
| 82 |
+
const RAmount = document.getElementById('RAmount'), FCount = document.getElementById('FCount');
|
| 83 |
+
const resetBtn = document.getElementById('resetBtn'), canvas = document.getElementById('canvas'), ctx = canvas.getContext('2d');
|
| 84 |
+
const flower = document.getElementById('flower'), happinessFill = document.getElementById('happinessFill'), body = document.body;
|
| 85 |
+
const maxMoney=5e9, maxPeople=8e9, basePetals=6, maxRings=5; let prevF=0;
|
| 86 |
+
function compute(){
|
| 87 |
+
const s=R.value/100, Rnorm=Math.pow(s,3), money=Rnorm*maxMoney;
|
| 88 |
+
let sliderF=+F.value; if(sliderF<prevF){sliderF=prevF; F.value=sliderF;} const moneyF=Rnorm*100;
|
| 89 |
+
const actualF=Math.max(sliderF, moneyF); prevF=actualF;
|
| 90 |
+
const fame=actualF/100, people=Math.round(fame*maxPeople);
|
| 91 |
+
let Binput=+B.value; if(R.value==0){Binput=0; B.disabled=true;} else B.disabled=false;
|
| 92 |
+
const boundaryCost=Binput*Math.pow(fame,2);
|
| 93 |
+
const RnormEff=Math.max(0,Rnorm*(1-boundaryCost));
|
| 94 |
+
const effectiveB=Binput*RnormEff;
|
| 95 |
+
const jur=+Jur.value;
|
| 96 |
+
const Enorm=fame*(1-effectiveB)*(1-effectiveB)*jur;
|
| 97 |
+
const U_money=Math.sqrt(RnormEff), U_bound=effectiveB, pen_exposure=Math.pow(Enorm,1.2);
|
| 98 |
+
let Hraw=U_money+U_bound-pen_exposure;
|
| 99 |
+
let Hnorm=Math.max(0,Math.min(1,(Hraw+0.5)/1.5));
|
| 100 |
+
const Hperc=Hnorm*100;
|
| 101 |
+
// dynamic money slider max
|
| 102 |
+
const newMax=Math.max(5, 100*(1-Hnorm*0.5)); R.max=newMax;
|
| 103 |
+
return {RnormEff,actualF,people,effectiveB,Enorm,boundaryCost,Hperc,Hnorm};
|
| 104 |
+
}
|
| 105 |
+
function draw(){
|
| 106 |
+
const {RnormEff,actualF,people,effectiveB,Enorm,boundaryCost,Hperc,Hnorm}=compute();
|
| 107 |
+
RVal.textContent=`${Math.round(R.value)}%`;
|
| 108 |
+
FVal.textContent=`${actualF.toFixed(0)}%`;
|
| 109 |
+
FCount.textContent=people.toLocaleString();
|
| 110 |
+
BVal.textContent=effectiveB.toFixed(2);
|
| 111 |
+
RAmount.textContent=`€${(RnormEff*maxMoney).toLocaleString()}`;
|
| 112 |
+
body.className=(R.value==0 && actualF==0)?'saddest':'normal';
|
| 113 |
+
body.style.setProperty('--happiness',Hperc);
|
| 114 |
+
happinessFill.style.width=`${Hperc}%`;
|
| 115 |
+
happinessFill.style.background=`hsl(${Hperc*1.2},80%,60%)`;
|
| 116 |
+
flower.classList.toggle('dead',Hperc===0);
|
| 117 |
+
flower.querySelectorAll('.petal').forEach(p=>p.remove());
|
| 118 |
+
const rings=Math.floor(Hnorm*maxRings);
|
| 119 |
+
for(let r=1;r<=rings;r++){
|
| 120 |
+
const petalsInRing=r*basePetals, radius=30+r*20;
|
| 121 |
+
for(let i=0;i<petalsInRing;i++){
|
| 122 |
+
const angle=(i/petalsInRing)*360;
|
| 123 |
+
const petal=document.createElement('div'); petal.className='petal';
|
| 124 |
+
petal.style.width='15px'; petal.style.height='15px';
|
| 125 |
+
petal.style.color=`hsl(${Hperc*1.2+(r-1)*30},80%,60%)`;
|
| 126 |
+
petal.style.transform=`rotate(${angle}deg) translateY(-${radius}px) rotate(-${angle}deg)`;
|
| 127 |
+
petal.style.opacity=Hnorm;
|
| 128 |
+
flower.appendChild(petal);
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
ctx.clearRect(0,0,canvas.width,canvas.height);
|
| 132 |
+
ctx.font='16px Arial'; ctx.fillStyle='#000';
|
| 133 |
+
ctx.fillText(`Money Util √R: ${Math.sqrt(RnormEff).toFixed(2)}`,20,30);
|
| 134 |
+
ctx.fillText(`Boundary Util: ${effectiveB.toFixed(2)}`,20,55);
|
| 135 |
+
ctx.fillText(`Boundary Cost: ${boundaryCost.toFixed(2)}`,20,80);
|
| 136 |
+
ctx.fillText(`Exposure Penalty: ${Enorm.toFixed(2)}`,20,105);
|
| 137 |
+
ctx.fillText(`Happiness: ${Hperc.toFixed(1)}%`,20,130);
|
| 138 |
+
ctx.fillStyle='rgba(0,0,0,0.1)'; ctx.fillRect(20,150,460,20);
|
| 139 |
+
ctx.fillStyle=`hsl(${Hperc*1.2},80%,60%)`; ctx.fillRect(20,150,(Hperc/100)*460,20);
|
| 140 |
+
ctx.fillStyle='#000'; ctx.font='14px "Segoe UI"'; ctx.fillText('Low H',20,185); ctx.fillText('High H',460,185);
|
| 141 |
+
}
|
| 142 |
+
[R,F,B,Jur].forEach(el=>el.addEventListener('input',draw));
|
| 143 |
+
resetBtn.addEventListener('click',()=>{R.value=0;F.value=0;B.value=0;Jur.value='0.6';prevF=0;draw();});
|
| 144 |
+
draw();
|
| 145 |
+
</script>
|
| 146 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=web3district/happy-combo" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 147 |
</html>
|