# Animating a mechanical arm

I have a code that was to simulate a mechanical arm, but something is not right.

What would be the solution so that i can get the animation?

Clear["Global*"];
BezierCircleArc[{x_,y_},r_,{θ1_,θ2_}]:=Module[{α,p0,p1,p2,p3},α=4/3 Tan[(θ2-θ1)/4];
p0={x,y}+r {Cos[θ1],Sin[θ1]};
p3={x,y}+r {Cos[θ2],Sin[θ2]};
p1=p0+α r {-Sin[θ1],Cos[θ1]};
p2=p3+α r {Sin[θ2],-Cos[θ2]};
BezierCurve[{p0,p1,p2,p3}]];
claws={EdgeForm[Black],GrayLevel[0.84],FilledCurve[{BezierCircleArc[{plenghtArmAnim[[#]]+16.8,0},rClaws=20,claw1a={0.8,2.9}],BezierCircleArc[{plenghtArmAnim[[#]]-5,5.6},2.5,claw1b={6.03-2*Pi,2.9-2*Pi}][[1;;All,2;;All]],BezierCircleArc[{plenghtArmAnim[[#]]+16.8,0},25,Reverse[claw1a]-2*Pi][[1;;All,2;;All]],BezierCircleArc[{plenghtArmAnim[[#]]+32.54,16.07},2.5,claw1c={0.8,-2.35}][[1;;All,2;;All]]}]};
robot={GeometricTransformation[{{BezierCircleArc[{plenghtArmAnim[[#]]+16.8,0},20,{2.57,3.72}],Line[{{0,12.5},{plenghtArmAnim[[#]],12.5},{plenghtArmAnim[[#]],12.5},{plenghtArmAnim[[#]],10.87}}],Line[{{0,-12.5},{plenghtArmAnim[[#]],-12.5},{plenghtArmAnim[[#]],-12.5},{plenghtArmAnim[[#]],-10.87}}],{EdgeForm[Black],GrayLevel[0.84],Disk[armCenter={0,0},18]},{EdgeForm[Black],GrayLevel[0.50],Disk[armCenter={0,0},6]}},u=GeometricTransformation[claws,{RotationTransform[0 Degree,{85,5.6}]}],GeometricTransformation[u,ReflectionTransform[{0,1},{85,0}]]},RotationTransform[initialPosition=angListAnim[[#]] Degree,{0,0}]]};
Flatten@@Table[Graphics[robot],1]&/@Range[300];
Export["C:\Users\JP\Desktop\animation.gif",%]


The data here are:

angListAnim

plenghtArmAnim

Try do this:

Flatten @@
Table[Graphics[{GeometricTransformation[{{BezierCircleArc[{plenghtArmAnim[[#]] + 16.8, 0}, 20, {2.57, 3.72}],
Line[{{0, 12.5}, {plenghtArmAnim[[#]], 12.5}, {plenghtArmAnim[[#]], 12.5}, {plenghtArmAnim[[#]],10.87}}],
Line[{{0, -12.5}, {plenghtArmAnim[[#]], -12.5},{plenghtArmAnim[[#]], -12.5}, {plenghtArmAnim[[#]], -10.87}}],{EdgeForm[Black], GrayLevel[0.84],
Disk[armCenter = {0, 0}, 18]}, {EdgeForm[Black],
GrayLevel[0.5], Disk[armCenter = {0, 0}, 6]}},
u = GeometricTransformation[{EdgeForm[Black],
GrayLevel[0.84],
FilledCurve[{BezierCircleArc[{plenghtArmAnim[[#]] + 16.8,
0}, rClaws = 20, claw1a = {0.8, 2.9}],
BezierCircleArc[{plenghtArmAnim[[#]] - 5, 5.6}, 2.5,
claw1b = {6.03 - 2*Pi, 2.9 - 2*Pi}][[1 ;; All,
2 ;; All]],
BezierCircleArc[{plenghtArmAnim[[#]] + 16.8, 0}, 25,
Reverse[claw1a] - 2*Pi][[1 ;; All, 2 ;; All]],
BezierCircleArc[{plenghtArmAnim[[#]] + 32.54, 16.07},
2.5, claw1c = {0.8, -2.35}][[1 ;; All,
2 ;; All]]}]}, {RotationTransform[
0*Degree, {85, 5.6}]}],
GeometricTransformation[u,
ReflectionTransform[{0, 1}, {85, 0}]]},
RotationTransform[
initialPosition = angListAnim[[#]]*Degree, {0, 0}]]}], 1] & /@
Range[300];
`