TransWikia.com

Rainbow arrow with snake decoration

TeX - LaTeX Asked on February 12, 2021

I have a simple question but I can not find a solution :
How can I get a simple snake arrow but with a rainbow color?

One Answer

Welcome! All important ingredients of this answer are from here.

documentclass[tikz,border=3mm]{standalone}
usetikzlibrary{shadings,fadings,arrows.meta,bending,decorations.pathmorphing}
pgfdeclarehorizontalshading{rainbow}{100bp}{% https://tex.stackexchange.com/a/344548/194703
  rgb(0bp)=(1,0,0);
  rgb(26bp)=(1,0,0);
  rgb(33bp)=(1,.5,0);
  rgb(40bp)=(1,1,0);
  rgb(47bp)=(0,1,0);
  rgb(54bp)=(0,1,1);
  rgb(61bp)=(0,0,1);
  rgb(68bp)=(1,0,1);
  rgb(75bp)=(.5,0,.5);
  rgb(100bp)=(.5,0,.5)}
begin{tikzfadingfrompicture}[name=my arrow]
 draw[transparent!0,ultra thick,decorate,decoration={snake,post length=2mm},
 -{Stealth}] (0,0) -- (2,0);
end{tikzfadingfrompicture}%
begin{document}
begin{tikzpicture}
 path [ postaction={shading=rainbow, path fading=my arrow, fit fading=false}] 
 (-1,-0.2) rectangle (1,0.2);
end{tikzpicture}
end{document}

enter image description here

BTW, for the future it would be great if you could post what you have tried.

Answered by user194703 on February 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP