I use the following code from this post, to draw dice simulation.
\documentclass[12pt,a4paper]{article}
\usepackage{verbatim}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords]
\begin{scope}[canvas is xy plane at z=3]
\path[draw=none, fill=brown!50!white] (-3,-3) rectangle (3,3);
\path (0,0) [line cap=round, line join=round, line width=0.9cm, rounded corners=0.9cm, inner color=green!70!black, outer color=green!70!black, rotate=18+90,transform shape] circle (2.cm);
\end{scope}
\begin{scope}[canvas is xz plane at y=3]
\path[draw=none, fill=brown!70!white] (-3,-3) rectangle (3,3);
\path (0,0) [line cap=round, line join=round, line width=0.9cm, rounded corners=0.9cm, inner color=yellow, outer color=yellow, rotate=18,transform shape] circle (2.cm);
\end{scope}
\begin{scope}[canvas is yz plane at x=3]
\path[draw=none, fill=brown!80!white] (-3,-3) rectangle (3,3);
\path (0,0) [line cap=round, line join=round, line width=0.9cm, rounded corners=0.9cm, inner color=red, outer color=red, rotate=18,transform shape] circle (2.cm);
\end{scope}
\end{tikzpicture}
\end{document}
How can I put this code in a style, to be repeated in different locations of the document, with different rotation angles.
Also how can I make this cube looks like a die, with controllable rounded corners.
Best Answer
I only made it, so that the angles work with the sides in the same order, but it could be made conditional dependent on the angle.