%let nstars = 151; %let ncp = 25000; 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 */ 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; proc iml; /* corona */ Mean = {.5, .5}; x = j(&ncp, 2, .); do i = 1 to 10000; do until(d > 0.25 & d < 1 & 0 <= t[1] & t[1] <= 1 & 0 <= t[2] & t[2] <= 1); t = RandNormal(1, Mean, 0.01 * {2 .994, .994 2}); d = sqrt((t[1] - 0.5) ** 2 + (t[2] - 0.5) ** 2); end; x[i,] = t; end; do i = 10001 to 20000; do until(d > 0.25 & d < 1 & 0 <= t[1] & t[1] <= 1 & 0 <= t[2] & t[2] <= 1); t = RandNormal(1, Mean, 0.01 * {1 -.994, -.994 1.5}); d = sqrt((t[1] - 0.5) ** 2 + (t[2] - 0.5) ** 2); end; x[i,] = t; end; do i = 20001 to &ncp; do until(d > 0.25 & d < 1 & 0 <= t[1] & t[1] <= 1 & 0 <= t[2] & t[2] <= 1); t = RandNormal(1, Mean, {.025 0, 0 .025}); d = sqrt((t[1] - 0.5) ** 2 + (t[2] - 0.5) ** 2); end; x[i,] = t; end; create frame40(rename=(col1=cx col2=cy)) from x; append from x; quit; data eclipse2; /* make it twinkle */ 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; cx = cx + 0.0005 * normal(70); cy = cy + 0.0005 * normal(70); 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=i); 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='Eclipse.gif'; ods graphics / width=4.9895in 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); 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 / colormodel=(black) colorresponse=moonX dataskin=sheen 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;