Animation Program

g=9.8;
kyug=1;
kyur=1; 
wakux=0;
wakuy=0;
wakur=3;(*5 or 3*)
stkyurad=-Pi/2;(*0 or Pi/2 or Pi or -Pi/2*)
stkyusprad=Pi;(*Pi or Pi/1.2 or Pi/2 or Pi/3*)
komakazu=60;(*40 or 60*)
timeend=15; (*4.6 or 15*)
dot={PointSize[0.02]};

dispkiseki=0;(* 0 or 1 *)

dispzanzou=1;(* 0 or 1 *)
zanzoukazu=4;(* 0 <= zanzoukazu *) 

dt=timeend/komakazu;

kailooprad=NDSolve[
		         {(wakur+kyur)*looprad''[t2]==-1*g*Sin[looprad[t2]+(Pi/2)]
					 ,looprad[0.0]==stkyurad
					 ,looprad'[0.0]==stkyusprad}
			      ,looprad
			      ,{t2,0,timeend}
	            ];
funclooprad=looprad /. First[kailooprad];

kyux[t1_]:=wakux+((wakur+kyur)*Cos[funclooprad[t1]]);
kyuy[t2_]:=wakuy+((wakur+kyur)*Sin[funclooprad[t2]]);
cycloidrad[t3_]:=(wakur/kyur)*funclooprad[t3];
cycloidx[t4_]:=kyux[t4]+(kyur*Cos[cycloidrad[t4]]);
cycloidy[t5_]:=kyuy[t5]+(kyur*Sin[cycloidrad[t5]]);
           
waku={
		                      {GrayLevel[0.0]
			                   ,Disk[{wakux,wakuy},wakur
			                               ,{0,Pi/2}]}
				              ,{GrayLevel[0.5]
			                   ,Disk[{wakux,wakuy},wakur
			                               ,{Pi/2,Pi}]}
		                   ,{GrayLevel[0.0]
			                   ,Disk[{wakux,wakuy},wakur
			                               ,{Pi,(3*Pi)/2}]}
				              ,{GrayLevel[0.5]
			                   ,Disk[{wakux,wakuy},wakur
			                             ,{(3*Pi)/2,2*Pi}]}			
				              ,{GrayLevel[0.0]
			                  ,Circle[{wakux,wakuy},wakur]}				             
				              };

kyu[t6_]:={
	                         {GrayLevel[0.0]
			                   ,Disk[{kyux[t6],kyuy[t6]},kyur
			                               ,{cycloidrad[t6]
					                             ,cycloidrad[t6]+(Pi/2)}]}
				              ,{GrayLevel[0.5]
			                   ,Disk[{kyux[t6],kyuy[t6]},kyur
			                               ,{cycloidrad[t6]+(Pi/2)
					                             ,cycloidrad[t6]+Pi}]}
				              ,{GrayLevel[0.0]
			                   ,Disk[{kyux[t6],kyuy[t6]},kyur
			                               ,{cycloidrad[t6]+Pi
					                             ,cycloidrad[t6]+(Pi*3/2)}]}
				              ,{GrayLevel[0.5]
			                   ,Disk[{kyux[t6],kyuy[t6]},kyur
			                               ,{cycloidrad[t6]+(Pi*3/2)
					                             ,cycloidrad[t6]+(2*Pi)}]}
					            ,{GrayLevel[0.0]
			                   ,Circle[{kyux[t6],kyuy[t6]},kyur]}					                   
				              };
level1[znum1_]:=Which[zanzoukazu<=8
					                           ,gray1=((N[8/zanzoukazu,1])*znum1)/10
					                           ,(zanzoukazu>8)&&(znum1<=8)
					                           ,gray1=znum1/10
					                           ,(zanzoukazu>8)&&(znum1>8)
					                           ,gray1=0.9];
level2[znum2_]:=Which[zanzoukazu<=4
					                           ,gray2=(((N[4/zanzoukazu,1])*znum2)+5)/10
					                           ,(zanzoukazu>4)&&(znum2<=4)
					                           ,gray2=(znum2+5)/10
					                           ,(zanzoukazu>4)&&(znum2>4)
					                           ,gray2=1.0];
zanzou[t7_,znum3_]:={
	                         {GrayLevel[level1[znum3]]
			                   ,Disk[{kyux[t7-(znum3*dt)]
					                             ,kyuy[t7-(znum3*dt)]},kyur
			                               ,{cycloidrad[t7-(znum3*dt)]
					                             ,cycloidrad[t7-(znum3*dt)]+(Pi/2)}]}
				              ,{GrayLevel[level2[znum3]]
			                   ,Disk[{kyux[t7-(znum3*dt)]
			                                 ,kyuy[t7-(znum3*dt)]},kyur
			                               ,{cycloidrad[t7-(znum3*dt)]+(Pi/2)
					                             ,cycloidrad[t7-(znum3*dt)]+Pi}]}
				              ,{GrayLevel[level1[znum3]]
			                   ,Disk[{kyux[t7-(znum3*dt)]
			                                 ,kyuy[t7-(znum3*dt)]},kyur
			                               ,{cycloidrad[t7-(znum3*dt)]+Pi
					                             ,cycloidrad[t7-(znum3*dt)]+(Pi*3/2)}]}
				              ,{GrayLevel[level2[znum3]]
			                   ,Disk[{kyux[t7-(znum3*dt)]
			                                 ,kyuy[t7-(znum3*dt)]},kyur
			                               ,{cycloidrad[t7-(znum3*dt)]+(Pi*3/2)
					                             ,cycloidrad[t7-(znum3*dt)]+(2*Pi)}]}
					            ,{GrayLevel[level1[znum3]]
			                   ,Circle[{kyux[t7-(znum3*dt)]
			                                  ,kyuy[t7-(znum3*dt)]},kyur]}				                   
				              };
zanzoulist[t9_]:=Which[zanzoukazu>(t9/dt)-1
		      ,Table[zanzou[t9,znum4+1],{znum4,0,(t9/dt)-1,1}]
		      ,zanzoukazu<=(t9/dt)-1
		      ,Table[zanzou[t9,znum5],{znum5,1,zanzoukazu,1}]];	
		
options={AspectRatio->Automatic
		  ,PlotRange->{{-wakur-(3*kyur),wakur+(3*kyur)}
		                                 ,{-wakur-(3*kyur),wakur+(3*kyur)}}
                      };
figure1=Which[
		          dispkiseki==1 
		      ,figure2={waku,kyu[t],dot}
		
		      ,dispkiseki==0
		      ,figure2={waku,kyu[t]}];
figures=Which[
		       (dispzanzou==1 )&& (zanzoukazu>0 )
		      ,figure3={figure1,zanzoulist[t]}
		
		      ,(dispzanzou==0 )||( zanzoukazu<=0 )
		      ,figure3={figure1}];
gifs={};(*gifsを初期化*)
Do[
	    AppendTo[dot,Point[{cycloidx[t],cycloidy[t]}]];
	   AppendTo[gifs,(*AppendToでgifsに追加*)
	 Show[
		             Graphics[figures
			                              ,options]
		   ]
]
	     ,{t,0,timeend,dt}
	] 
Needs["Graphics`Animation`"]
ShowAnimation[gifs]