You have already solved most of the problems, the only step that appears to remain is to put the spheres in 3d order. This can be done by computing the screen depths of some appropriate coordinates and draw the spheres on the respective layers. To simplify this task I have used slightly different coordinates, which I also store in functions like `Ax` and so on.
```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{backgrounds,fpu}% calc gets loaded by tikz-3dplot
\makeatletter
% projection of a 3d coordinate on the normal of the screen
\pgfmathdeclarefunction{screendepth}{3}{%
\begingroup%
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
\pgfmathparse{%
((\the\pgf@yx/1cm)*(\the\pgf@zy/1cm)-(\the\pgf@yy/1cm)*(\the\pgf@zx/1cm))*(#1)+
((\the\pgf@zx/1cm)*(\the\pgf@xy/1cm)-(\the\pgf@xx/1cm)*(\the\pgf@zy/1cm))*(#2)+
((\the\pgf@xx/1cm)*(\the\pgf@yy/1cm)-(\the\pgf@yx/1cm)*(\the\pgf@xy/1cm))*(#3)}%
\pgfmathsmuggle\pgfmathresult\endgroup%
}%
% position of a real in a list of reals
\pgfmathdeclarefunction*{pos}{2}{%
\begingroup%
\c@pgf@counta=1%
\pgfutil@for\my@item:={#2}\do{%
\ifdim\my@item pt<#1pt%
\advance\c@pgf@counta by1%
\fi}%
\edef\pgfmathresult{\the\c@pgf@counta}%
\pgfmathsmuggle\pgfmathresult\endgroup%
}
\makeatother
\newcounter{tdorder}
\begin{document}
\foreach \X in {1,...,4}
{\pgfdeclarelayer{layer\X}}
\pgfsetlayers{layer1,layer2,layer3,layer4,main}
\foreach \Angle in {5,15,...,355}
{\tdplotsetmaincoords{70}{\Angle}
\begin{tikzpicture}[scale=2,tdplot_main_coords,
dot/.style={circle,fill,inner sep=0pt,minimum size=2.4pt},
declare function={R=1;a=R/sin(60);
Ax=a*cos(-30);Ay=a*sin(-30);
Bx=0;By=R;
Cx=a*cos(210);Cy=a*sin(210);
Sz=R*sqrt(69)/3;
alpha=atan2(Sz,R);
xi=sin(alpha);}]
\path (Ax,Ay,0) coordinate (A)
(Bx,By,0) coordinate (B)
(Cx,Cy,0) coordinate (C)
(0,0,0) coordinate (G)
(0,0,Sz) coordinate (S)
foreach \v/\position in {A/below,B/below,C/below,S/above,G/below}
{(\v) node[dot,label=\position:{$\v$}]{}};
\begin{scope}[A/.style={ball color=red!80},
B/.style={ball color=orange!90},C/.style={ball color=blue!70},
S/.style={ball color=cyan!90}]
\path[use as bounding box,tdplot_screen_coords] (-3,-1.5) rectangle (3,5.5);
\pgfmathsetmacro{\sdA}{screendepth(xi*Ax,xi*Ay,0)}
\pgfmathsetmacro{\sdB}{screendepth(xi*Bx,xi*By,0)}
\pgfmathsetmacro{\sdC}{screendepth(xi*Cx,xi*Cy,0)}
\pgfmathsetmacro{\sdS}{screendepth(0,0,0)}
\edef\lstsd{\sdA,\sdB,\sdC,\sdS}
\foreach \X in {A,B,C,S}
{%
\expandafter\edef\expandafter\currsd\expandafter{\csname sd\X\endcsname}
\setcounter{tdorder}{1}
\foreach \sd in \lstsd
{\pgfmathtruncatemacro{\itest}{ifthenelse(\sd<\currsd,1,0)}
\ifnum\itest=1
\stepcounter{tdorder}
\fi}
\begin{pgfonlayer}{layer\number\value{tdorder}}
\def\tmpS{S}
\ifx\X\tmpS
\fill[S,tdplot_screen_coords] (S) circle[radius=2*R];
\else
\fill[style/.expanded=\X,tdplot_screen_coords] (\X) circle[radius=R];
\fi
%\typeout{\X\space on layer \number\value{tdorder}; \lstsd}
\end{pgfonlayer}
}
\end{scope}
\draw[help lines,dashed] (S) -- (A) (S)--(B) (S)--(C) (A)--(B) (A)--(C) (B)--(C) (A)--(G) (B)--(G) (C)--(G) (S)--(G);
\end{tikzpicture}}
\end{document}
```
![ani.gif](/image?hash=e2700ee9557b25325bf73afe6605056e41daf04109b84a4433f81ad08177ca06)
Some of the routines here are part of the `3dtools` library, which got discontinued.