|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Package for fading along a lineHello,
I have implemented a small package that allows to fade an edge so that the fading is aligned with the edge (without having to provide explicit angles for fading rotation). An example together with the package itself is attached. I would be interested in sharing this, so my question is: what's the right way to do it? Shall I just post it on CTAN as a separate package or maybe there is a repository of user-submitted tikz libraries? Maybe someone would even want to integrate it into the main distribution? Best, Misha \documentclass{article} \usepackage{tikz} \usepackage{tikztricks} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[every node/.style = draw] \node (A) {A}; \node [below right = of A] (B) {B}; \draw (B) edge[faded, green, very thick, <-] (A); \end{tikzpicture} \end{document} %% `tizktricks.sty' v 1.0 %% %% (c) 2009 Mihhail Aizatulin, <avatar@...> %% %% Provides the following facilities: %% %% - Fading an edge so that the fading is automatically aligned with the edge %% %% Try this: %% \begin{tikzpicture}[every node/.style = {circle, draw}] %% \node (A) {A}; %% \node (B) [below left = of A] {B}; %% \draw (A) edge[faded = basic fading] (B); %% \end{tikzpicture} %% %% 12.06.2009: initial version \ProvidesPackage{tikztricks} \NeedsTeXFormat{LaTeX2e}[1995/06/01] \RequirePackage{tikz} \usetikzlibrary{calc,fadings} \begin{tikzfadingfrompicture}[name = basic fading] \shade[left color = transparent!0, right color = transparent!100] rectangle (100bp, 100bp); \end{tikzfadingfrompicture} \tikzset{ faded/.default = basic fading, faded/.style = { to path = { [ draw = none, execute at begin to = { \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfsetfading{#1}{ \pgftransformlineattime{0}{\pgfpointanchor{X}{center}}{\pgfpointanchor{Y}{center}} % could just do scaling here as well: \pgftransformtriangle{\pgfpointorigin}{\pgfpointscale{0.01}{\pgfpointanchor{Y}{center}}}{\pgfpoint{0}{1pt}} \pgftransformshift{\pgfpoint{50bp}{0}} } \pgftransparencygroup }, execute at end to = {\endpgftransparencygroup} ] % Make (X) and (Y) the corners of the area to shade (\tikztostart) -- coordinate [at start] (X) coordinate [at end] (Y) (\tikztotarget) (X) edge[to path = {(X) -- (Y)}] (Y) }} } \endinput ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
| Free embeddable forum powered by Nabble | Forum Help |