diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html
index ec7f2b30f..74c5a5168 100644
--- a/site/preview-v2/index.html
+++ b/site/preview-v2/index.html
@@ -996,7 +996,11 @@
Single visual-only transient, no synthetic route or native DSP mutation.
The travelling wave spans the shrinking jacket and the detached plug
is a FREE end: it moves with the final wave rather than being pinned. */
-const WIRE_RETRACT_MS=520;
+/* V66 fast, lively elastic recoil: OUT stays fixed while a travelling
+ whip reaches the entire shrinking cable. The disconnected dot is free:
+ a damped tip response makes it wobble rather than ride a rigid chord.
+ Visual-only; graph REMOVE always commits before this animation exists. */
+const WIRE_RETRACT_MS=330;
let wireRetractToken=0,wireRetractOverlay=null;
function stopWireRetraction(){
++wireRetractToken;
@@ -1004,46 +1008,56 @@
}
function wireRetractPose(x0,y0,rx,ry,elapsedMs){
const p=Math.max(0,Math.min(1,elapsedMs/WIRE_RETRACT_MS));
- // 42% shorter than V64, brisk at the beginning and softly decelerating.
- const remaining=Math.pow(1-p,2.25);
+ // Fast pull from the first frame, no preceding fall/hang/idle phase.
+ const remaining=Math.pow(1-p,2.65);
const x=x0+(rx-x0)*remaining,y=y0+(ry-y0)*remaining;
const chord=Math.hypot(rx-x0,ry-y0);
- const length01=Math.max(0,Math.min(1,(chord-85)/270));
+ const length01=Math.max(0,Math.min(1,(chord-90)/270));
const longMix=length01*length01*(3-2*length01);
- // The pulse traverses the *whole* cable before reel-in is over.
- // OUT -> FREE end, then leaves a short damped trailing tail.
- const front=1.5*(1-Math.pow(1-Math.min(1,p/.55),1.35));
- const width=.62-.25*longMix; // fewer smoother lobes on short cables
- const sag=Math.min(46,Math.max(9,Math.sqrt(chord)*2.1))*
- Math.pow(remaining,.72);
- const amplitude=Math.min(19,Math.max(7,Math.sqrt(chord)*.95))*
- (.42+.58*longMix)*Math.pow(remaining,.47)*Math.min(1,p/.095);
- return {x,y,remaining,sag,front,width,amplitude,phase:'reel'};
+ // Front originates at OUT and reaches the loose tip early enough that
+ // the tip can swing repeatedly BEFORE the wire disappears.
+ const front=1.42*(1-Math.pow(1-Math.min(1,p/.40),1.35));
+ const catchUp=Math.max(0,Math.min(1,(front-.78)/.30));
+ const width=.59-.24*longMix;
+ const sag=Math.min(44,Math.max(10,Math.sqrt(chord)*2.1))*
+ Math.pow(remaining,.78);
+ const amplitude=Math.min(32,Math.max(14,Math.sqrt(chord)*1.5))*
+ (.46+.54*longMix)*Math.pow(remaining,.29)*
+ Math.min(1,p/.07)*Math.min(1,chord*remaining/55);
+ const recoil=amplitude*.13*catchUp*
+ Math.sin(2*Math.PI*Math.max(0,p-.19)/.26);
+ return {p,x,y,remaining,sag,front,catchUp,width,amplitude,recoil,phase:'reel'};
}
function wireRetractWave(pose,t){
- const passed=pose.front-t; // first near OUT, then all along the cable
- if(passed<=0)return 0;
- const sourceAnchor=Math.min(1,t/.035);
- // Unlike the connected socket, the unplugged end is not tethered:
- // the sine displaces the plug itself, so it never looks rigid.
- return -pose.amplitude*Math.sin(2*Math.PI*passed/pose.width)*
- Math.exp(-1.05*passed-.32*t)*sourceAnchor;
+ const passed=pose.front-t;
+ const travelling=passed>0?
+ -Math.sin(2*Math.PI*passed/pose.width)*
+ Math.exp(-.77*passed-.35*t):0;
+ // The travelling pulse excites an inertial after-swing at the FREE tip.
+ // Its influence smoothly increases toward that end, without moving OUT.
+ const lag=Math.max(0,pose.p-.19);
+ const tipSwing=1.15*pose.catchUp*Math.sin(2*Math.PI*lag/.26)*
+ Math.exp(-1.25*lag)*Math.pow(t,1.65);
+ return pose.amplitude*Math.min(1,t/.04)*(travelling+tipSwing);
}
function wireRetractPathData(x0,y0,rx,ry,elapsedMs){
const pose=wireRetractPose(x0,y0,rx,ry,elapsedMs);
const dx=pose.x-x0,dy=pose.y-y0;
const norm=Math.max(1,Math.hypot(dx,dy));
- const nx=-dy/norm,ny=dx/norm;
+ const nx=-dy/norm,ny=dx/norm,tx=dx/norm,ty=dy/norm;
let d='M '+x0.toFixed(1)+' '+y0.toFixed(1);
for(let i=1;i<=64;i++){
const t=i/64;
const wave=wireRetractWave(pose,t);
- const x=x0+dx*t+nx*wave;
- const y=y0+dy*t+pose.sag*Math.sin(Math.PI*t)+ny*wave;
+ const surge=pose.recoil*t*t;
+ const x=x0+dx*t+nx*wave+tx*surge;
+ const y=y0+dy*t+pose.sag*Math.sin(Math.PI*t)+ny*wave+ty*surge;
d+=' L '+x.toFixed(1)+' '+y.toFixed(1);
}
const endWave=wireRetractWave(pose,1);
- return {d,pose:{...pose,tipX:pose.x+nx*endWave,tipY:pose.y+ny*endWave}};
+ return {d,pose:{...pose,
+ tipX:pose.x+nx*endWave+tx*pose.recoil,
+ tipY:pose.y+ny*endWave+ty*pose.recoil}};
}
function startWireRetraction(sourceId,releasePoint){
stopWireRetraction();
@@ -1091,7 +1105,7 @@
// Visual plug follows the same free endpoint as the final SVG sample.
plug.setAttribute('cx',shape.pose.tipX.toFixed(1));
plug.setAttribute('cy',shape.pose.tipY.toFixed(1));
- plug.setAttribute('r',Math.max(0,5.2*Math.pow(shape.pose.remaining,.6)).toFixed(2));
+ plug.setAttribute('r',Math.max(0,5.8*Math.pow(shape.pose.remaining,.48)).toFixed(2));
if(elapsed{
+ window.__v66ReelFrames=[];
+ window.__v66ReelObserver=new MutationObserver(()=>{
+ const layer=document.querySelector('#wireRetractLayer');
+ const plug=layer?.querySelector('[data-wire-retract-plug]');
+ const jacket=layer?.querySelector('[data-wire-retract-jacket]');
+ if(!plug||!jacket)return;
+ const x=Number(plug.getAttribute('cx')),y=Number(plug.getAttribute('cy'));
+ if(Number.isFinite(x)&&Number.isFinite(y))
+ window.__v66ReelFrames.push({x,y,r:Number(plug.getAttribute('r')),
+ phase:layer.dataset.wirePhase,
+ d:jacket.getAttribute('d')});
+ });
+ window.__v66ReelObserver.observe(document.getElementById('viewport'),
+ {childList:true,subtree:true,attributes:true,attributeFilter:['cx','cy','d']});
+ }""")
other=page.locator('#tracks .strip[data-id="4"] .wire-node-in')
t=dst.bounding_box();q=other.bounding_box()
blank_x=(cx(t)+cx(q))/2
blank_y=cy(t)
page.mouse.move(cx(t),cy(t));page.mouse.down()
page.mouse.move(blank_x,blank_y,steps=12);page.mouse.up()
- assert page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-5"]').count()==0,\
- "unplug must remove committed edge immediately"
- overlay=page.locator('#wireRetractLayer[data-wire-retract="1"]')
- assert overlay.count()==1,"accepted unplug must have transient cable"
- assert overlay.get_attribute("data-wire-phase")=="reel"
- assert overlay.evaluate("(el)=>getComputedStyle(el).pointerEvents")=="none"
- jacket=overlay.locator('[data-wire-retract-jacket]')
- plug=overlay.locator('[data-wire-retract-plug]')
- first=plug.evaluate("(el)=>[Number(el.getAttribute('cx')),Number(el.getAttribute('cy'))]")
- first_path=jacket.get_attribute("d")
- page.wait_for_timeout(175)
- moved=plug.evaluate("(el)=>[Number(el.getAttribute('cx')),Number(el.getAttribute('cy'))]")
+ assert page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-5"]').count()==0, \
+ "unplug must REMOVE the graph edge immediately"
+ page.wait_for_timeout(450)
+ frames=page.evaluate("window.__v66ReelFrames")
source_x=cx(src.bounding_box())
- assert abs(moved[0]-source_x){
- const path=el.querySelector('[data-wire-retract-jacket]');
- const plug=el.querySelector('[data-wire-retract-plug]');
- const end=path.getPointAtLength(path.getTotalLength());
- return Math.hypot(end.x-Number(plug.getAttribute('cx')),
- end.y-Number(plug.getAttribute('cy')));
- }""")
- assert tip_gap<.25,("free plug is detached from the wavy jacket",tip_gap)
- assert jacket.get_attribute("d")!=first_path,"reel never animated the jacket"
- assert overlay.evaluate("(el)=>getComputedStyle(el).clipPath")=="none"
+ assert len(frames)>=6,("fast plug-out never animated in real browser",frames[:2])
+ distances=[abs(item["x"]-source_x) for item in frames]
+ assert distances[0]>max(25,distances[-1]*2.5), \
+ ("free plug did not reel briskly toward OUT",distances)
+ delta=max(item["y"] for item in frames)-min(item["y"] for item in frames)
+ assert delta>12,("plug dot did not visibly swing with the WIRE",delta)
+ assert frames[-1]["r"]OUT plug-in behavior.
- model=HTML[HTML.index("const WIRE_RETRACT_MS=520"):
+ # Exact production code evaluated in Chromium: a strong pulse starts at
+ # OUT, travels through the middle and far cable, then throws the loose
+ # plug from side to side. It fades to zero as remaining length runs out.
+ model=HTML[HTML.index("const WIRE_RETRACT_MS=330"):
HTML.index("function startWireRetraction(")]
physics=page.evaluate("()=>{\n"+model+"""\n
const chord=400;
@@ -392,45 +397,46 @@ def test_replug_and_retract(page):
const {d,pose}=wireRetractPathData(0,0,chord,0,ms);
const ys=d.match(/-?\d+(?:\.\d+)?/g).map(Number);
const t=i/64;
- const baseline=pose.sag*Math.sin(Math.PI*t);
- return ys[2*i+1]-baseline;
+ return ys[2*i+1]-pose.sag*Math.sin(Math.PI*t);
};
- const early=wireRetractPathData(0,0,chord,0,135);
- const middle=wireRetractPathData(0,0,chord,0,220);
- const flex=wireRetractPathData(0,0,chord,0,175);
+ const early=wireRetractPathData(0,0,chord,0,50);
+ const middle=wireRetractPathData(0,0,chord,0,120);
+ const crest=wireRetractPathData(0,0,chord,0,135);
const finished=wireRetractPathData(0,0,chord,0,WIRE_RETRACT_MS);
- const shortPose=wireRetractPose(0,0,80,0,115);
- const longPose=wireRetractPose(0,0,chord,0,115);
+ const shortPose=wireRetractPose(0,0,80,0,95);
+ const longPose=wireRetractPose(0,0,chord,0,95);
+ const tip=ms=>wireRetractPathData(0,0,chord,0,ms).pose.tipY;
+ const svgTip=crest.d.match(/-?\d+(?:\.\d+)?/g).map(Number).slice(-2);
return {
- nearOutEarly:deviation(40,8),farEarly:deviation(40,51),
- midAfter:deviation(125,32),farAfter:deviation(155,48),
- freeTipWave:deviation(175,64),
- sourceAnchor:deviation(175,0),
- halfwayX:middle.pose.x,earlyX:early.pose.x,
- tipX:flex.pose.tipX,tipY:flex.pose.tipY,
+ nearOut:deviation(20,8),farEarly:deviation(20,51),
+ middleSwing:deviation(60,32),farSwing:deviation(80,48),
+ tipFirst:tip(100),tipRebound:tip(135),
+ sourceAnchor:deviation(135,0),earlyX:early.pose.x,
+ middleX:middle.pose.x,tipX:crest.pose.tipX,
+ tipY:crest.pose.tipY,svgTip,
completeX:finished.pose.tipX,completeY:finished.pose.tipY,
shortAmplitude:shortPose.amplitude,longAmplitude:longPose.amplitude,
startPhase:early.pose.phase,finishAmplitude:finished.pose.amplitude
};
}""")
- assert abs(physics["nearOutEarly"])>2,("reel has no abrupt OUT-origin whip",physics)
- assert abs(physics["farEarly"])<.4,("free tip moves before OUT-origin front arrives",physics)
- assert abs(physics["midAfter"])>2 and abs(physics["farAfter"])>2,\
- ("wavy must travel through the whole jacket, not just near OUT",physics)
- assert abs(physics["freeTipWave"])>3,\
- ("loose plug remains rigid when wave arrives",physics)
- assert abs(physics["sourceAnchor"])<.25,("OUT socket endpoint shifted",physics)
- assert 03,("tip never reacts to wave",physics)
+ assert abs(physics["nearOut"])>3 and abs(physics["farEarly"])<.4, \
+ ("impulse must start at OUT, not at the free plug",physics)
+ assert abs(physics["middleSwing"])>7 and abs(physics["farSwing"])>9, \
+ ("wave fails to excite the entire shortening cable",physics)
+ assert abs(physics["tipFirst"])>10 and abs(physics["tipRebound"])>17, \
+ ("dot/loose plug does not swing enough",physics)
+ assert physics["tipFirst"]*physics["tipRebound"]<0, \
+ ("free dot must whip back in the opposite direction",physics)
+ assert abs(physics["sourceAnchor"])<.25,"source OUT socket cannot move"
+ assert 0