I’d reversed the values in the final line…. Doh!
With some assistance from Adobe Expression reference:
startR = 800; //start rotation 800 pixels from camera
endR = 300; //end rotation 300 pixels from camera
C = thisCoe.activeCamera.toWorld([0,0,0]);
P = toWorld(anchorPoint);
d = length(C,P);
linear(d,startR,endR,-20,0)