Skip to content

Commit caf28f7

Browse files
committed
feat: 30s Live Plot simulation + honest machine-speed readout
The HUD now shows the real plot time (e.g. Zaku 23:21) while the simulation plays it back in ~30s at 1x watch speed. A new dock readout discloses the compression honestly — "SIM ≈ ×47 MACHINE SPEED" — recomputed per suit (bigger suits → higher multiplier, e.g. ×65 for a 32:43 plot) and per watch speed (0.5×→×23, 4×→×187). BASE trimmed 36→30s on index + preview. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWP9tY4m4hfX8WyoEQZ1kU
1 parent 0b99ed7 commit caf28f7

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ <h1>PLOTFLOW<span class="s">*</span></h1>
9393
<button class="btn" id="restart">Restart</button>
9494
<button class="btn" id="skip">Skip ▸︎▸︎</button>
9595
<div class="seg" id="speed"><button data-s="0.5">0.5×</button><button data-s="1" class="on"></button><button data-s="2"></button><button data-s="4"></button></div>
96+
<span class="tiny" id="simx" style="color:var(--dim);letter-spacing:.08em;align-self:center"></span>
9697
</div>
9798
</header>
9899

preview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ <h2>The Work<span class="star">*</span></h2><span class="jp">作品</span>
337337
const bed=document.getElementById('bed'), bedlabel=document.getElementById('bedlabel');
338338
const selSuit=document.getElementById('suit'), playBtn=document.getElementById('play'), replay=document.getElementById('replay');
339339

340-
const FEED=1100, BASE=36;
340+
const FEED=1100, BASE=30;
341341
let cur, len=1, drawn=0, playing=true, speed=1, mmPerUnit=1, totalMin=1;
342342

343343
ORDER.forEach(k=>{const o=document.createElement('option');o.value=k;o.textContent=SUITS[k].name+" · "+SUITS[k].code;selSuit.appendChild(o);});

scripts/plotter.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
var LIFT_S = 0.10; // seconds per pen lift+lower cycle (servo up + down)
2929
// Plot time = draw + pen-up travel + lift cycles — tuned against PlotGrid
3030
// actuals (~0.45 s/stroke incl. overhead), not just ink-length ÷ feed.
31-
var BASE = 36; // seconds for a full plot at 1x speed
31+
var BASE = 30; // seconds the simulation runs at 1x watch speed —
32+
// the machine-speed multiplier shown in the dock is
33+
// derived from the real plot time (≈ x45–x60)
3234
var INK = '#e8351f';
3335
var cur, len = 1, drawn = 0, painted = 0, playing = true, speed = 1, mmPerUnit = 1, totalMin = 1;
3436
var vb = { x: 0, y: 0, w: 1, h: 1 };
@@ -141,6 +143,7 @@
141143
totalMin = (st.draw * mmPerUnit) / FEED
142144
+ (st.travel * mmPerUnit) / TRAVEL_FEED
143145
+ (st.lifts * LIFT_S) / 60;
146+
updateSimX();
144147
penC.setAttribute('r', md * 0.014);
145148
penX.setAttribute('d', 'M ' + (-md * 0.032) + ' 0 H ' + (md * 0.032) + ' M 0 ' + (-md * 0.032) + ' V ' + (md * 0.032));
146149
pen.setAttribute('opacity', '0');
@@ -184,6 +187,14 @@
184187
if (playBtn) playBtn.textContent = 'Pause';
185188
}
186189

190+
// honest speed disclosure: the sim runs the real plot in BASE/speed seconds
191+
function updateSimX() {
192+
var el = $('simx');
193+
if (!el || !totalMin) return;
194+
var x = Math.round((totalMin * 60) / (BASE / speed));
195+
el.textContent = 'SIM \u2248 \u00d7' + x + ' machine speed';
196+
}
197+
187198
var last = null;
188199
function frame(t) {
189200
if (last == null) last = t;
@@ -213,6 +224,7 @@
213224
var b = e.target.closest('button'); if (!b) return;
214225
[].forEach.call(e.currentTarget.children, function (x) { x.classList.remove('on'); });
215226
b.classList.add('on'); speed = parseFloat(b.dataset.s);
227+
updateSimX();
216228
});
217229
if (selSuit) selSuit.addEventListener('change', function (e) { load(e.target.value); });
218230
if (replay) replay.addEventListener('click', restart);

scripts/product.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
function makePreview(s, inkHex) {
102102
var svg = $("pdSvg"), path = $("pdPath"), canvas = $("pdCanvas"), replay = $("pdReplay");
103103
var ctx = canvas.getContext("2d");
104-
var BASE = 18; // seconds for a full preview plot
104+
var BASE = 18; // seconds for a full preview plot (product page keeps a quicker cut)
105105
var ink = inkHex;
106106
var len = 1, drawn = 0, painted = 0, playing = true, last = null;
107107
var vb = { x: 0, y: 0, w: s.w || 1, h: s.h || 1 };

0 commit comments

Comments
 (0)