0

This post is an extension of the post How to Restrict the Circular Span of a Radial Fading Tikzpicture

Consider the code

\documentclass{book}
% Code can be compiled with Pdflatex or Xelatex
\usepackage{tikz} 
\usetikzlibrary{fadings}
\definecolor{darkamber}{RGB}{213,54,0}
\definecolor{sunriseyellow}{RGB}{255,219,0}
\definecolor{topaz}{RGB}{255,200,124}

\begin{document}
\thispagestyle{empty}

\tikzfading[name=fade out, inner color=transparent!0,
outer color=transparent!100]
\tikzset{
  star/.style={darkamber, fill=white, path fading=fade out}
}

\begin{tikzpicture}
\clip (-3, -3) rectangle (3, 3);
  \draw[darkamber, shading=mradial, inner color=topaz, 
  middle color=darkamber!60!sunriseyellow, outer color=darkamber]
  (-3, -3) rectangle (3, 3);
\end{tikzpicture}

\vspace*{25pt}

\begin{tikzpicture}
  \clip (-3, -3) rectangle (3, 3);
  \draw[darkamber, shading=mradial, inner color=topaz, 
  middle color=darkamber!60!sunriseyellow, outer color=darkamber]
  (-3, -3) rectangle (3, 3);
  \fill[darkamber] (180:4cm) arc (180:360:4cm) -- (0,0) -- cycle; % <---- The pie piece
\end{tikzpicture} 
\end{document}

which produces the two images:

enter image description here

I would like to be able to produce the second image in a more expedient manner; e.g., by specifying that the full-circle "radial glow" of the first image should only sweep out 0 degrees to 180 degrees instead of the apparent default 0 degrees to 360 degrees.

The desired second image is obtained by superimposing a darkamber rectangle on the bottom half of the first image.

QUESTION: Is it possible, and if so, how may I modify the code which produces the first image so that it may be specified to produce the glow from (in this case) from 0 degrees to 180 degrees; and more generally, from, say, a degrees to b degrees without having to superimpose a second solid image atop the first to achieve the desired effect? Thank you.

NOTE: In How to Restrict the Circular Span of a Radial Fading Tikzpicture, user SebGlav says, ``There is a way to restrict, but you need to fill the background before. In any case, you'll have to do it with two commands.''

2
  • I still don't see the point in your question. You fill a square with your background colour, then fill a shape of your own with the shading and it produces what you want. If you want to restrict the shading to a specific shape, then you will not have a coloured background underneath it, unless you filled it before. Maybe could you elaborate about why you need to do these two commands in one, to enlighten us.
    – SebGlav
    Jun 21 at 21:35
  • @SebGlav I tried to in the posting; perhaps I was not clear enough. Let me try it this way by asking you this---If I wanted to create a radial glow for the portion of the circle, say, 75 le theta le 95 (degrees) , would it not be more expedient, if it were possible, to specify that along the lines I just did, as opposed to trying to figure out how to create the necessary polygon in order to superimpose it on the first image? I do not know if what I am looking for is possible, or feasible from your admonition. In any case, I thought I would ask. Thank you again for your previous answer. Jun 21 at 21:46

0

Your Answer

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

Browse other questions tagged or ask your own question.