7

In order to define the opacity of a fill I can use fill opacity = 0.5. But consider this example:

\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \fill[blue](-0.5, -0.5) rectangle(0, 0.5);
  \fill[green](0, -0.5) rectangle(0.5, 0.5);
  \shadedraw[inner color = red, draw=none](0, 0) circle(0.3);
\end{tikzpicture}
\end{document}

The result is:

enter image description here

I would like the outer rim of the inner circle to gradually merge into the background. Hence, I have on purpose evaded the definition of outer color. However, the default is obviously outer color=white. I would like the outer color to be completely translucid. How to make that happen?

7

Apparently you need to define a fading with the transparency first:

\documentclass[tikz,margin=1pt]{standalone}
\usetikzlibrary{fadings}
\tikzfading
  [name = viesturs fading,
   inner color = transparent!0,
   outer color = transparent!100]
\begin{document}
\begin{tikzpicture}
  \fill[blue](-0.5, -0.5) rectangle(0, 0.5);
  \fill[green](0, -0.5) rectangle(0.5, 0.5);
  \path[path fading = viesturs fading, inner color = red](0, 0) circle(0.3);
\end{tikzpicture}
\end{document}

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.