8 課題

8.3　アニメーション

b1=Graphics3D[Cylinder[{{-2,0,0},{15,0,0}},1.5]]
b2=Graphics3D[Cylinder[{{-3.5,0,0},{0,0,0}},0.3]]

s1=Graphics3D[Sphere[{0,0,0},2]]
c1=Graphics3D[Cone[{{0,0,4},{0,0,0}},2]]
c2=Graphics3D[Cone[{{0,0,-4},{0,0,0}},2]]

Animate[
Show[b1,b2,c1,c2,
Graphics3D[
{Translate[
Sphere[{0,0,0},2],{-2*i,i*16*Sin[d],i*16*Cos[d]+6}
],Tube[BSplineCurve[{{-2,0,0},{-2,16*Sin[e],16*Cos[e]-2},{-2,16*Sin[f],16*Cos[f]},{-2*i,i*16*Sin[d]+2,i*16*Cos[d]+6}}]
]
}
]
],
{d,Pi,0,Pi/100},{e,Pi,Pi/1.3,Pi/100},{f,Pi,Pi/1.6,Pi/100},{i,1,0,Pi/100}]

Animate[Show[b1,b2,Graphics3D[
{Translate[
Sphere[{0,0,0},2],{0,0,8*Sin[j]+6}
],Tube[BSplineCurve[{{-2,0,0},{-2,16*Sin[Pi/1.3],16*Cos[Pi/1.3]},{-2,16*Sin[Pi/1.6],16*Cos[Pi/1.6]},{0,0,8*Sin[j]+6}}]
]
,
Cone[{{0,4*Sin[g],4*Cos[g]},{0,0,0}},2],Cone[{{0,4*Cos[h],-4*Sin[h]},{0,0,0}},2]
}]],
{g,0,Pi,Pi/50},{h,Pi/2,3Pi/2,Pi/50},{j,0,Pi,Pi/50}]