Code :
new vars declaration at top - ditch the 2 radius vars and RArm
new loads in setup:
The new arm routines:
{ //Left Arm
pushMatrix();
translate(-50, -10);
// we need this angle for lower arm calc
UArmAngle = radians(100*float(mouseX)/width);
rotate(UArmAngle);
shape(LUpper, 0, 0);
popMatrix();
}
{
pushMatrix();
// we could just add this to the translation below,
// but leaving it separate shows the composition clearly
translate(-50, -10);
// offset to next quadrant (our SVG's are vertical!)
float newAngle = UArmAngle + PI/2;
// move to the end point of upper arm - 60 is length in SVG file
// from 0 to a nice attachment point, inside the ellipse
translate(cos(newAngle) * 60, sin(newAngle) * 60);
// add a little extra bend to show usage
rotate(UArmAngle + map(UArmAngle, 0, 1.75, -PI/4, PI/2));
shape(LLower, 0, 0);
popMatrix();
}
"UpLArm.svg"
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="10px" height="72px" viewBox="0 -10 10 72" enable-background="new 0 -10 10 72" xml:space="preserve">
<rect x="-4" y="2" fill="#C7B299" stroke="#000000" width="8" height="56"/>
<ellipse transform="matrix(0.5 -0.866 0.866 0.5 0 0)" fill="#FFD3D2" stroke="#000000" cx="0" cy="0" rx="11" ry="8.2"/>
</svg>
"LoLArm.svg"
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="10px" height="58px" viewBox="0 0 10 58" enable-background="new 0 0 10 58" xml:space="preserve">
<rect x="-3" y="2" fill="#C7B299" stroke="#000000" width="6" height="40"/>
<ellipse transform="matrix(-0.5 -0.866 0.866 -0.5 -2.114318e-004 3.662112e-004)" fill="#FFD3D2" stroke="#000000" cx="0" cy="0" rx="6.5" ry="7.8"/>
<ellipse fill="#FFD3D2" stroke="#000000" cx="0" cy="40" rx="9.8" ry="5.5"/>
</svg>
"UpRArm.svg"
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="10px" height="72px" viewBox="0 -10 10 72" enable-background="new 0 -10 10 72" xml:space="preserve">
<rect x="-4" y="2" fill="#C7B299" stroke="#000000" width="8" height="56"/>
<ellipse transform="matrix(-0.5 -0.866 0.866 -0.5 0 0)" fill="#FFD3D2" stroke="#000000" cx="0" cy="0" rx="11" ry="8.2"/>
</svg>
"LoRArm.svg"
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="10px" height="58px" viewBox="0 0 10 58" enable-background="new 0 0 10 58" xml:space="preserve">
<rect x="-3" y="2" fill="#C7B299" stroke="#000000" width="6" height="40"/>
<ellipse transform="matrix(0.5 -0.866 0.866 0.5 -2.114318e-004 1.220701e-004)" fill="#FFD3D2" stroke="#000000" cx="0" cy="0" rx="6.5" ry="7.8"/>
<ellipse fill="#FFD3D2" stroke="#000000" cx="0" cy="40" rx="9.8" ry="5.5"/>
</svg>