I observed the following:
- The spaces between \only{} are always rendered (\only, when not active, is a "zero-width character"; TeX does not discard spaces between characters)
- Set the width of the text explicitly using "text width=...". This implicitly puts the content into a minipage.
- Note that the "baseline" property does not work anymore as expected.
- "text centered" ensures the alignment for the case that the content is not exactly "text-width"
- The "overprint" environment only automatically determines the height of the content, not the width.
To conclude, this works for me (I tried it):
\tikz[baseline]
\node [fill=blue!20,draw,circle,anchor=base,text width=4ex,text centered,inner sep=0] (node1)
{
\only<1-3>{3}\only<4-6>{8}\only<7->{11.5}
};
EDIT: This works with the correct baseline:
\tikz[baseline=(node1.base)]
\node [fill=blue!20,draw,circle] (node1)
{
\begin{minipage}{4ex}
\centering
\only<1-3>{3}\only<4-6>{8}\only<7->{11.5}
\end{minipage}
};