Leggermente OT 🙂 , ma visto sia la prossima ricorrenza sia l’interesse di Lorenzo penso sia carino augurare buona Pasqua con TikZ-uova:
[attachment=648]KbYfv.png[/attachment]
Il codice: `
\documentclass{article}
\usepackage{tikz,charter}
\usetikzlibrary{hobby,
shapes.geometric,
decorations,
decorations.shapes,
shapes.geometric,
patterns
}
% http://www.guitex.org/home/it/forum/5-tex-e-latex/83195-la-libreria-hobby-tikz-non-funziona-piu#83203
\ExplSyntaxOn
\cs_if_exist:NF \prg_stepwise_function:nnnN { \cs_gset_eq:NN \prg_stepwise_function:nnnN \int_step_function:nnnN }
\cs_if_exist:NF \prg_stepwise_inline:nnnn { \cs_gset_eq:NN \prg_stepwise_inline:nnnn \int_step_inline:nnnn }
\ExplSyntaxOff
\makeatletter
\pgfdeclareradialshading[tikz@ball]{easter bg}{\pgfpoint{5bp}{25bp}}{%
color(0cm)=(tikz@ball!20);
color(0.15cm)=(tikz@ball!30);
color(0.4cm)=(tikz@ball!60);
color(0.9cm)=(tikz@ball)
}
\tikzoption{easter bg color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{easter bg}\tikz@addmode{\tikz@mode@shadetrue}}
\pgfkeys{/tikz/easter star/.code args={#1 and #2}{
\pgfdeclareradialshading[tikz@ball]{easter star}{\pgfpoint{#1}{#2}}{%
color(0cm)=(tikz@ball!20);
color(0.3cm)=(tikz@ball!40);
color(0.65cm)=(tikz@ball!60);
color(1cm)=(tikz@ball)
}
}
\tikzoption{easter star color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{easter star}\tikz@addmode{\tikz@mode@shadetrue}}
}
\makeatother
% original code by Paul Gaborit:
% tex.stackexchange.com/questions/72784/arrow-with-two-colors-with-tikz/#72793
\tikzset{
double path/.style args={#1 colored by #2 and #3}{
-,line join=round,line cap=rect,
shorten >=0.1cm,
shorten <=0.1cm,
line width=#1,#2, % first path
postaction={draw,-,#3,line width=(#1)/1.5,
shorten <=(#1)/3,shorten >=(#1)/3,
}, % second path
}
}
\tikzset{easter decoration 1/.style={
decorate,
decoration={
shape backgrounds,
shape=star,shape size=7pt,
shape sep={0.5cm, between center},
},
inner color=yellow,
outer color=yellow!50!orange,
draw=red!20!orange,
}
}
\pgfdeclarepatternformonly{fivepointed stars easter 2}{\pgfpointorigin}{\pgfpoint{10mm}{10mm}}{\pgfqpoint{10mm}{8mm}}%
{
\pgftransformshift{\pgfqpoint{1mm}{1mm}}
\pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
\pgfpathlineto{\pgfqpointpolar{162}{1mm}}
\pgfpathlineto{\pgfqpointpolar{306}{1mm}}
\pgfpathlineto{\pgfqpointpolar{90}{1mm}}
\pgfpathlineto{\pgfqpointpolar{234}{1mm}}
\pgfpathclose%
\pgfusepath{fill}
}
\tikzset{easter decoration 3/.style={
draw=green!17!yellow,
line width=2pt,
star,
}
}
\pgfdeclarepatternformonly{fivepointed stars easter 3}{\pgfpointorigin}{\pgfpoint{12mm}{12mm}}{\pgfqpoint{12mm}{11mm}}%
{
\pgftransformshift{\pgfqpoint{1mm}{1mm}}
\pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
\pgfpathlineto{\pgfqpointpolar{162}{1mm}}
\pgfpathlineto{\pgfqpointpolar{306}{1mm}}
\pgfpathlineto{\pgfqpointpolar{90}{1mm}}
\pgfpathlineto{\pgfqpointpolar{234}{1mm}}
\pgfpathclose%
\pgfusepath{fill}
}
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
\begin{document}
% Easter Egg 1
\begin{tikzpicture}[use Hobby shortcut]
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 1};
% path clipping
\clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
% shading
\shade[easter bg color=orange,scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
% colored paths
\draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.775,0.35) .. (0.735,0.35) .. (0.65,0.3) .. (0.45,0.4) .. (0.235,0.355) .. (0.225,0.35);
\draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.5) .. (0.775,0.55) .. (0.55,0.5) .. (0.45,0.6) .. (0.235,0.55) .. (0.1,0.5);
\draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.7) .. (0.775,0.75) .. (0.55,0.7) .. (0.45,0.8) .. (0.235,0.75) .. (0.1,0.7);
% stars
\draw[easter decoration 1,scale=-6] (0.775,0.25) .. (0.735,0.25) .. (0.65,0.2) .. (0.45,0.3) .. (0.235,0.255) .. (0.225,0.25);
\draw[easter decoration 1,scale=-6] (0.9,0.4) .. (0.775,0.45) .. (0.55,0.4) .. (0.45,0.5) .. (0.235,0.45) .. (0.1,0.4);
\draw[easter decoration 1,scale=-6] (0.9,0.6) .. (0.775,0.65) .. (0.55,0.6) .. (0.45,0.7) .. (0.235,0.65) .. (0.1,0.6);
\draw[easter decoration 1,scale=-6] (0.9,0.8) .. (0.775,0.85) .. (0.55,0.8) .. (0.45,0.9) .. (0.235,0.85) .. (0.1,0.8);
% draw again the border
\draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
% Easter Egg 2
\begin{tikzpicture}[use Hobby shortcut]
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 2};
% path clipping
\clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
% shading
\draw[easter bg color=blue!65!cyan,scale=-6,postaction={pattern=fivepointed stars easter 2,pattern color=blue}](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
\node[star,scale=2.25,easter star=2bp and 10bp, easter star color=cyan!65!blue] at (0.35,0.75){};
\node[star,scale=1.5,easter star=-2bp and 15bp, easter star color=cyan!85!blue,rotate=10] at (1.45,1.45){};
\node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!75!blue,rotate=-10] at (-0.5,1.95){};
\node[star,scale=1.65,easter star=5bp and 15bp, easter star color=cyan!45!blue,rotate=-5] at (-0.75,-0.85){};
\node[star,scale=1.7,easter star=5bp and 15bp, easter star color=cyan!37!blue,rotate=-3] at (0,-1.65){};
\node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!60!blue,rotate=2] at (0.85,-0.65){};
\node[star,scale=1.75,easter star=-2bp and 2bp, easter star color=cyan!60!blue,rotate=14] at (2,0){};
\end{scope}
% draw again the border
\draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
% Easter Egg 3
\begin{tikzpicture}[use Hobby shortcut]
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 3};
% path clipping
\clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
% shading
\draw[easter bg color=green!77!blue,scale=-6,postaction={pattern=fivepointed stars easter 3,pattern color=green!20!yellow}](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
\node[easter decoration 3,scale=2.25] at (0.55,0.65){};
\node[easter decoration 3,scale=1.5,rotate=10] at (1.45,1.45){};
\node[easter decoration 3,scale=1.5,rotate=-10] at (-0.5,1.95){};
\node[easter decoration 3,scale=1.65,rotate=-5] at (-0.75,-0.70){};
\node[easter decoration 3,scale=1.7,rotate=-3] at (0,-1.65){};
\node[easter decoration 3,scale=1.5,rotate=2] at (0.85,-0.65){};
\node[easter decoration 3,scale=1.75,rotate=14] at (2,0){};
\end{scope}
% draw again the border
\draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
\end{document}
` Probabilmente è un po’ più complicato rispetto ai classici disegni: chi vorrà cimentarsi per studiarlo potrà però imparare come costruirsi ombreggiature proprie e personalizzarle (colorazione, punto di luce, ecc…), come personalizzare “in due minuti” nuovi pattern (presi dalla libreria ufficiale e modificata solo la “distanza” fra le stelle) e utilizzare quella libreria semi-sconosciuta quale [tt]decorations.shapes[/tt].
EDIT: oh.. messaggio 900 🙂
Ciao
Claudio