Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following code:

\begin{tikzpicture}[decoration={random steps,segment length=8pt,amplitude=4pt},thick]

  \begin{scope}[opacity=.8,transparency group]
    \draw[fill=yellow,draw=none] (-4,3.75) rectangle (4,3);
    \draw[fill=yellow,draw=none,opacity=0.8] (-3.8,3.2) rectangle (3.84,2);
  \end{scope}
  \node[anchor=west] at (4.5,3.5) {hv};
  \draw[dash pattern=on 20pt off 10pt,line width=30pt,draw=white] (-4,2.5) -- (4,2.5);
  \draw[dash pattern=on 20pt off 10pt,line width=2pt] (-4,3) -- (4,3);
  \node[anchor=west] at (4.5,3) {Mask};
  \filldraw[fill=blue!20]
    (4,1.5)
    decorate { -- (4,2) }
    -- (-4,2)
    decorate { -- (-4,1.5) };
  \node[anchor=west] at (4.5,1.75) {Hydrogel};
  \filldraw[fill=orange] 
    (-4,0) -- (4,0)
    decorate { -- (4,1.5) }
    -- (-4,1.5)
    decorate { -- (-4,0) };
  \node[anchor=west] at (4.5,0.75) {Substrat};
\end{tikzpicture}

Which results in this image:

enter image description here

Now I want to add a shiny effect to the hv, like a blurred outline. How is this achievable?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

One idea would be to use path fading. For instance, I used path fading = south in hydrogel. The code is

\documentclass[11pt,a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}%<--------You sould add this to your preamble
\usetikzlibrary{%<-----------You should add this to your preamble
    calc,%
    fadings,%
shadings%
}
\listfiles
\begin{document}

\begin{tikzpicture}[decoration={random steps,segment length=8pt,amplitude=4pt},thick]

  \begin{scope}[opacity=.8,transparency group]
    \draw[fill=yellow,draw=none] (-4,3.75) rectangle (4,3);
    \draw[fill=yellow,draw=none,opacity=0.8] (-3.8,3.2) rectangle (3.84,2);
  \end{scope}
  \node[anchor=west] at (4.5,3.5) {hv};
  \draw[dash pattern=on 20pt off 10pt,line width=30pt,draw=white] (-4,2.5) -- (4,2.5);
  \draw[dash pattern=on 20pt off 10pt,line width=2pt] (-4,3) -- (4,3);
  \node[anchor=west] at (4.5,3) {Mask};
  \filldraw[fill=blue!20, path fading=south]%<---------Here I added 'path fading=south'
    (4,1.5)
    decorate { -- (4,2) }
    -- (-4,2)
    decorate { -- (-4,1.5) };
  \node[anchor=west] at (4.5,1.75) {Hydrogel};
  \filldraw[fill=orange] 
    (-4,0) -- (4,0)
    decorate { -- (4,1.5) }
    -- (-4,1.5)
    decorate { -- (-4,0) };
  \node[anchor=west] at (4.5,0.75) {Substrat};
\end{tikzpicture}

\end{document}

The output is

:

Or if you like the HV to be shiny, try this

\begin{tikzpicture}[decoration={random steps,segment length=8pt,amplitude=4pt},thick]

  \begin{scope}[opacity=.8,transparency group]
    \draw[fill=yellow,draw=none, path fading=south] (-4,3.75) rectangle (4,3);%<-------
    \draw[fill=yellow,draw=none,opacity=0.8, path fading=north] (-3.8,3.2) rectangle     (3.84,2);%<------------
  \end{scope}
  \node[anchor=west] at (4.5,3.5) {hv};
  \draw[dash pattern=on 20pt off 10pt,line width=30pt,draw=white] (-4,2.5) -- (4,2.5);
  \draw[dash pattern=on 20pt off 10pt,line width=2pt] (-4,3) -- (4,3);
  \node[anchor=west] at (4.5,3) {Mask};
  \filldraw[fill=blue!20]
    (4,1.5)
    decorate { -- (4,2) }
    -- (-4,2)
    decorate { -- (-4,1.5) };
  \node[anchor=west] at (4.5,1.75) {Hydrogel};
  \filldraw[fill=orange] 
    (-4,0) -- (4,0)
    decorate { -- (4,1.5) }
    -- (-4,1.5)
    decorate { -- (-4,0) };
  \node[anchor=west] at (4.5,0.75) {Substrat};
\end{tikzpicture}

The output is

share|improve this answer
1  
That looks good, thanks for the input! –  Reza Feb 2 '13 at 12:40
    
@Reza: You are so welcome! Glad to help! Enjoy! –  Thanos Feb 2 '13 at 14:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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