将不透明度范围设置为透明度

将不透明度范围设置为透明度

我有这棵树forest,我想让每个区域的颜色在到达下一个区域之前淡入透明状态,但每当我玩淡入淡出时,颜色的不透明度设置都会被忽略,我可以使用什么包?

\documentclass[border=10pt]{standalone}
\usepackage{forest}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}

\usetikzlibrary{calc, backgrounds}

\begin{document}

\begin{forest}
for tree={calign=fixed edge angles},
[CP,name=cp [,phantom]
[C' 
[C]
[TP,name=tp [,phantom]
[T' 
[T]
[VP,name=vp [,phantom]
[V' 
[V] [,phantom]]]]]]]
\draw[rotate=30, name path=cpbow] ([shift={(150:2 and 0)}]cp) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\draw[rotate=30, name path=tpbow] ([shift={(150:2 and 0)}]tp) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\draw[rotate=30, name path=vpbow] ([shift={(150:2 and 0)}]vp) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\path[rotate=30, name path=xpbow] ([shift={(150:2 and 0)}]$(vp)!-1!(tp)$) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\begin{scope}[on background layer]
\fill[red, opacity=0.25, intersection segments={
        of=cpbow and tpbow, sequence={A* -- B*[reverse]}
    }] -- cycle;
\fill[yellow, opacity=0.25, intersection segments={
        of=tpbow and vpbow, sequence={A* -- B*[reverse]}
    }] -- cycle;
\fill[green, opacity=0.25, intersection segments={
        of=vpbow and xpbow, sequence={A* -- B*[reverse]}
    }] -- cycle;
\end{scope}
\end{forest}

\end{document}

我正在寻找的结果是这样的,在森林树下面: 在此处输入图片描述

提前谢谢您!

答案1

虽然不完全是需要的,但是玩一玩shading angle并强迫middle color你可以获得或多或少可用的东西。

尽管更好的解决方案在于定义您自己的阴影方案。

\documentclass[border=10pt]{standalone}
\usepackage{forest}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}

\usetikzlibrary{calc, backgrounds}

\begin{document}

\begin{forest}
for tree={calign=fixed edge angles},
[CP,name=cp [,phantom]
[C' 
[C]
[TP,name=tp [,phantom]
[T' 
[T]
[VP,name=vp [,phantom]
[V' 
[V] [,phantom]]]]]]]
\draw[rotate=30, name path=cpbow] ([shift={(150:2 and 0)}]cp) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\draw[rotate=30, name path=tpbow] ([shift={(150:2 and 0)}]tp) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\draw[rotate=30, name path=vpbow] ([shift={(150:2 and 0)}]vp) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\path[rotate=30, name path=xpbow] ([shift={(150:2 and 0)}]$(vp)!-1!(tp)$) 
    arc[start angle=150, end angle=30, x radius=2, y radius=1];
\begin{scope}[on background layer]
\fill[top color=red, bottom color=white, middle color=red!20, shading angle=30, intersection segments={
        of=cpbow and tpbow, sequence={A* -- B*[reverse]}
    }] -- cycle;
\fill[top color=yellow, bottom color=white, middle color=yellow!20, shading angle=30, intersection segments={
        of=tpbow and vpbow, sequence={A* -- B*[reverse]}
    }] -- cycle;
\fill[top color=green, bottom color=white, middle color=green!20, shading angle=30, intersection segments={
        of=vpbow and xpbow, sequence={A* -- B*[reverse]}
    }] -- cycle;
\end{scope}
\end{forest}

\end{document}

在此处输入图片描述

相关内容