%let nstars = 151; %let ncp = 408; data eclipse(drop=i); /* Generate points for sun/moon */ array starx[&nstars] _temporary_; array stary[&nstars] _temporary_; call streaminit(8212017); do i = 1 to dim(starx); starx[i] = uniform(104); stary[i] = uniform(104); end; cx = 0.5; cy = 0.5; g = 0; do frame=1 to 90; /* At different times/locations */ moonid = frame; do i = 1 to &nstars; stx = starx[i]; sty = stary[i]; output; end; call missing (sty, stx); sunX=.5; sunY=.5; sz=50; output; /* Sun plotted at constant position in frame */ sunX=.; sunY=.; moonX = ifn(frame <= 41, .5+(41-frame)*(.775/40), ifn(frame <= 46, .5, /* Sun emerges from behind moon in last frames */ .5-(frame-46)*(.775/40))); moonY=.5; sz=49; output; /* Make moon slightly smaller bubble than sun */ moonX=.; moonY=.; sz=1; output; /* "Dummy" points with size=1 make sun/moon bigger */ /*-_Background polygon--*/ skyid=frame; x=0; y=-1; output; x=1; output; y= 1; output; x=0; output; call missing (skyid, x, y); if 40 le frame le 48 then do; /* place holder for corona */ do g = 1 to &ncp; output; end; cx = 0.5; cy = 0.5; end; end; run; data corona; pi = constant('pi'); id = 1; do t = 0 to 2 * pi by 2 * pi / 4; x = 0.5 + 0.5 * cos(t); y = 0.5 + 0.5 * sin(t); output; end; do t = 2 * pi / 8 to 2 * pi by 2 * pi / 4; x = 0.5 + 0.15 * cos(t); y = 0.5 + 0.15 * sin(t); output; end; run; proc sort out=corona; by id t; run; data frame40(keep=cx cy); set corona; x0 = lag(x); y0 = lag(y); if _n_ gt 1 then do; b = (y - y0) / (x - x0); a = y0 - b * x0; do cx = x0 to x by (x - x0) / 50; cy = a + b * cx; output; end; end; run; data eclipse2; set eclipse; by frame; if first.frame then i = 0; if (41 le frame le 48) and (1 le g le &ncp) then do; i + 1; set frame40 point=i; end; run; data mymap; retain id "sky "; length min max 8 colormodel1 colormodel2 $ 12; input max colormodel2; colormodel1 = lag(colormodel2); if colormodel1 eq ' ' then colormodel1 = colormodel2; min = sum(lag(max), 1); datalines; 20 lightblue 35 gray 41 black 46 black 52 gray 67 lightblue 90 lightblue ; data myrattrmap; set mymap mymap(in=j) mymap(in=i); if j then id = 'moon'; if i then do; id = 'star'; altcolormodel1 = ifc(colormodel1 = 'black', 'yellow', colormodel1); altcolormodel2 = ifc(colormodel2 = 'black', 'yellow', colormodel2); call missing(colormodel1,colormodel2); end; run; ods _all_ close; options papersize=('5 in', '3.8 in') printerpath=gif animation=start animduration=.1 animloop=yes noanimoverlay nobyline nonumber; ods printer file='NewEclipse.gif'; ods graphics / width=5in height=3.7999in dataskinmax=100000 groupmax=100000 antialiasmax=100000 attrpriority=none; proc sgplot data=eclipse2 noautolegend noborder nowall rattrmap=myrattrmap; styleattrs datalinepatterns=(solid) datacontrastcolors=(white) backcolor=lightgray; by frame; polygon id=skyid x=x y=y / colorresponse=skyid fill nooutline rattrid=sky; scatter x=stx y=sty / rattrid=star colorresponse=frame markerattrs=(symbol=starfilled size=3px); vector x=cx y=cy / lineattrs=(pattern=1 color=cxdddddd thickness=3px) noarrowheads xorigin=.5 yorigin=.5; bubble x=sunX y=sunY size=sz / colormodel=(yelloworange) colorresponse=sunX dataskin=sheen bradiusmax=120; bubble x=moonX y=moonY size=sz / colorresponse=moonid rattrid=moon nooutline bradiusmax=120; yaxis display=none min=0 max=1 offsetmin=0 offsetmax=0; xaxis display=none min=0 max=1 offsetmin=0 offsetmax=0; run; options printerpath=gif animation=stop; ods printer close; ods listing;