This answer proposes to use preaction
and|or postaction
to define a style which draws all three layers in one command but doesn't solve the problem about equally distributed 11 dots between two points.
\documentclass{article}\usepackage{tikz}\makeatletter\tikzset{ dot diameter/.store in=\dot@diameter, dot diameter=3pt, dot spacing/.store in=\dot@spacing, dot spacing=10pt, dots/.style={ line width=\dot@diameter, line cap=round, dash pattern=on 0pt off \dot@spacing }, mydots/.style={ dot spacing=3.8mm, preaction={draw=black, dot diameter=3mm, dots}, draw = white, dot diameter=2.5mm, dots, postaction={draw=black, dot diameter=1mm, dots}, }}\makeatother\begin{document} \begin{tikzpicture} \draw [mydots] (0,0) -- (4,0); \draw [mydots] (0,1) .. controls (3,1) and (4,2).. (3,3); \end{tikzpicture}\end{document}
Image may be NSFW.
Clik here to view.
Update: Parametric version: \mydots={dot dimension}{distance}
\documentclass[tikz,border=2mm]{standalone}\makeatletter\tikzset{ dot diameter/.store in=\dot@diameter, dot diameter=3pt, dot spacing/.store in=\dot@spacing, dot spacing=10pt, dots/.style={ line width=#1, line cap=round, dash pattern=on 0pt off \dot@spacing }, mydots/.style 2 args={ dot spacing=#2, preaction={draw=black, dots=#1}, draw = white, dots=.8*#1, postaction={draw=black, dots=.333*#1}, }}\makeatother\begin{document} \begin{tikzpicture} \draw [mydots={3mm}{3.8mm}] (0,0) -- (4,0); \draw [mydots={2mm}{5mm}] (0,1) .. controls (3,1) and (4,2).. (3,3); \end{tikzpicture}\end{document}