The TikZ and PGF Packages
Manual for version 3.1.10
TikZ Library shadows ¶
\usetikzlibrary[shadows] % ConTeXt
This library defines styles that help adding a (partly) transparent shadow to a path or node.
A shadow is usually a black or gray area that is drawn behind a path or a node, thereby adding visual depth to a picture. The shadows library defines options that make it easy to add shadows to paths. Internally, these options are based on using the preaction option to use a path twice: Once for drawing the shadow (slightly shifted) and once for actually using the path.
Note that you can only add shadows to paths, not to whole scopes.
In addition to the general shadow option, there exist special options like circular shadow. These can only (sensibly) be used with a special kind of path (for circular shadow, a circle) and, thus, they are not as general. The advantage is, however, that they are more visually pleasing since these shadows blend smoothly with the background. Note that these special shadows use fadings, which few printers will support.
70.2 The General Shadow Option¶
The shadows are internally created by using a single option called general shadow. The different options like drop shadow or copy shadow only differ in the commands that they preset.
You will not need to use this option directly under normal circumstances.
/tikz/general shadow=⟨shadow options⟩ (default empty) ¶
/tikz/shadow scale=⟨factor⟩ (no default, initially 1) ¶
/tikz/shadow xshift=⟨dimension⟩ (no default, initially 0pt) ¶
/tikz/shadow yshift=⟨dimension⟩ (no default, initially 0pt) ¶
This option should be given to a \path or a node. It has the following effect: Before the path is used normally, it is used once with the ⟨shadow options⟩ in force. Furthermore, when the path is “preused” in this way, it is shifted and scaled a little bit.
In detail, the following happens: A preaction is used to paint the path in a special manner before it is actually painted. This “special” manner is as follows: The options in ⟨shadow options⟩ are used for painting this path. Typically, the ⟨shadow options⟩ will contain options like fill=black to create, say, a black shadow. Furthermore, after the ⟨shadow options⟩ have been set up, the following extra canvas transformations are applied to the path: It is scaled by shadow scale (with the origin of scaling at the path’s center) and it is shifted by shadow xshift and shadow yshift.
Note that since scaling and shifting is done using canvas transformations, shadows are not taken into account when the picture’s bounding box is computed.
Shadows are scaled by ⟨factor⟩.
Shadows are shifted horizontally by ⟨dimension⟩.
Shadows are shifted vertically by ⟨dimension⟩.
70.3 Shadows for Arbitrary Paths and Shapes¶
70.3.1 Drop Shadows¶
/tikz/drop shadow=⟨shadow options⟩ (default empty) ¶
This option adds a drop shadow to a \path or a node. It uses the general shadow and passes the ⟨shadow options⟩ to it, plus, before them, the following extra options:
/tikz/every shadow(style, initially empty) ¶
This style is executed in addition to any ⟨shadow options⟩ for each shadow. Use this style to reconfigure the way shadows are drawn.
70.3.2 Copy Shadows¶
A copy shadow is not really a shadow. Rather, it looks like another copy of the path drawn behind the path and a little bit offset. This creates the visual impression of having multiple copies of the path/object present.
/tikz/copy shadow=⟨shadow options⟩ (default empty) ¶
This shadow installs the following default options:
Furthermore, the options fill=⟨fill color⟩ and draw=⟨draw color⟩ are also set, where the ⟨fill color⟩ and ⟨draw color⟩ are the fill and draw colors used for the main path.
/tikz/double copy shadow=⟨shadow options⟩ (default empty) ¶
This shadow works like a copy shadow, only the shadow is added twice, the second time with the double xshift and yshift.
70.4 Shadows for Special Paths and Nodes¶
The shadows in this section should normally be added only to paths that have a special shape. They will look strange with other shapes.
/tikz/circular drop shadow=⟨shadow options⟩(no default) ¶
This shadow works like a drop shadow, only it adds a circular fading to the shadow. This means that the shadow will fade out at the border. The following options are preset for this shadow:
/tikz/circular glow=⟨shadow options⟩(no default) ¶
This shadow works much like the circular shadow, only it is not shifted. This creates a visual effect of a “glow” behind the circle. The following options are preset for this shadow:
An especially interesting effect can be achieved by only using the glow and not filling the path: