Dear traveler of the webs from the far distant future: You sought an answer for your troubles, maybe you have come to the right place ....

I came up with a small script that changes the color of a spring based on strain. Put it into OnUpdate to work.

// Tangens hyperbolicus function.

// Linear for small value, than converges slowly to 1.

function tanh (arg) {

return (Math.exp(arg) - Math.exp(-arg)) / (Math.exp(arg) + Math.exp(-arg));

}

//Get Koordinates of springs

x1= parseFloat(this.Anchor1.split(",")[0]);

y1= parseFloat(this.Anchor1.split(",")[1]) ;

x2= parseFloat(this.Anchor2.split(",")[0]) ;

y2= parseFloat(this.Anchor2.split(",")[1]) ;

// calculate springs length

d = Math.sqrt(Math.pow((x1-x2),2) + Math.pow((y1-y2),2));

// factor to exaggerate visual represention of strain

exaggeration_factor = 12;

// calculate strain

strain =(d - this.DesiredDistance) / this.DesiredDistance;

// calculate color

stress = tanh(exaggeration_factor * strain)

// change Springs color based on strain.

// More red for stretch

// More yellow for compression

if (stress>0) this.Color = new QColor(stress *255,0,0);

if (stress<0) this.Color = new QColor(-stress * 255,-stress * 255,0);