How do I draw cracks effectively in TikZ like those shown below?

Collected from the Internet

Drawing cracks with --++ and angles and length like the way I did in the MWE seems too cumbersome. There must be some better way? Perhaps one way might be to make the path gradually tapering, with the initial side having thicker lines and the final side having thinner lines?


\definecolor{ZircMetalLight}{RGB}{203, 203, 203}


    left color = ZircMetalDark,
    right color = ZircMetalDark,
    middle color = ZircMetalLight,
    shading angle = 90,draw
](-4.5,0) rectangle (0,4.75);
\shade[ball color=red] (0,81.70pt) coordinate (a) circle (3pt);

\draw[black,thick]  (a) --++ (110:7pt) --++(140:6pt) --+(120:4pt)
            (a) --++ (110:7pt) --++(100:6pt) --+(110:4pt)
            (a) --++ (160:5pt) --++(190:6pt) --+(170:4pt)
            (a) --++ (160:5pt) --++(120:6pt) --+(160:4pt)
            (a) --++ (200:7pt) --++(190:6pt) --+(210:4pt)
            (a) --++ (200:7pt) --++(220:6pt) --+(210:4pt)
            (a) --++ (240:5pt) --++(230:6pt) --+(210:4pt)
            (a) --++ (240:5pt) --++(260:6pt) --+(230:4pt);
\shade[ball color=red] (0,81.70pt) coordinate (a) circle (3pt);



  • 1
    Somewhat related: tex.stackexchange.com/questions/147385/… Mar 12 at 21:25
  • This one's useful, but the line thickness is uniform there. I am wondering how about making the line path wider at start and then tapering gradually to a point at the end.
    – SolidMark
    Mar 12 at 21:29
  • Also everytime you recompile with fractal line in the code, it does draw some arbitrary ragged lines randomly at each recompile. Is there a way to make it static once I found my choice of arbitrary lines, so that they don't change in the next recompilation?
    – SolidMark
    Mar 12 at 21:40

1 Answer 1


Here is a proposal (using fractal line from https://tex.stackexchange.com/a/152492/14500).

The last parameter of \drawcraks is the seed (an integer) for the pseudo-random generator. Change it to get other results.

  fractal line/.style args={#1 and #2}{%
    % #1 is ratio of length to move the middle of each segment
    % #2 is the minimum length to apply the recurrence
    to path={
      \p1=(\tikztostart), % start point
      \p2=(\tikztotarget), % end point
      \n1={veclen(\x1-\x2,\y1-\y2)}, % distance 
      \p3=($(\p1)!.5!(\p2)$), % middle point
      \p4=(rand*#1*\n1,rand*#1*\n1), % random vector
      \p5=(\x3+\x4,\y3+\y4) % random moved middle point
      in \pgfextra{
        %\typeout{#1, #2, \n1}
        \ifnum\mytest=1 %
        \tikzset{fractal line/.style args={#1 and #2}{line to}}
      } to[fractal line=#1 and #2] (\p5) to[fractal line=#1 and #2] (\p2)

  % [style] start, target
  \path[#1] (#2) to[fractal line=.04 and 1mm] (#3) to[fractal line=.04 and 1mm] (#2);

  % [style] start, anglemin, anglestep, anglemax, distance, numsep, seed
  \foreach \angle in {#3,\angletwo,...,#5}{
    \path (#2) ++(\angle+rand*#4*.5:\crackdistone pt) coordinate (crack1);
    \foreach \mynum in {1,...,#7}{
      \path (crack1) ++(\angle+rand*#4:\crackdisttwo pt) coordinate (crack2);


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.