[心得][轉文] 新年到了﹐用 TikZ 畫個煙花給大家

看板LaTeX (論文排版)作者 (Ch'enMeng)時間11年前 (2014/01/02 10:02), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
原文轉自 LaTeX studio: http://www.latexstudio.net/happy-new-year/ 煙花效果詳見地址﹕ http://www.latexstudio.net/wp-content/uploads/2013/01/fireworks.gif
代碼﹕ \documentclass[tikz]{standalone} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing,decorations.shapes} \begin{document} \foreach \radius in {1,2,...,20} { \begin{tikzpicture} % background rectangle \filldraw[black] (-3,-3) rectangle (5,3); % skyline \filldraw[black!80!blue](-3,-3)--(-3,-2)--(-2.5,-2)--(-2.5,-1)--(-2.25,-1)--(-2.25,-2)--(-2,-2) --(-2,-1)--(-1.75,-0.75)--(-1.5,-1) --(-1.5,-2)--(-1.1,-2)--(-1.1,0)--(-0.5,0)--(-0.5,-2) --(0,-2)--(0,-1.5)--(1,-1.5)--(1.25,-0.5)--(1.5,-1.5)--(1.5,-2) --(2,-2)--(2,0)--(2.5,0)--(2.5,-2) --(3,-2)--(3,-1)--(4,-1)--(4,-2)--(5,-2)--(5,-3)--cycle; % moon- what a hack! \filldraw[white] (4,2.5) arc (90:-90:20pt); \filldraw[black] (3.8,2.5) arc (90:-90:20pt); % fireworks \pgfmathparse{100-(\radius-1)*10}; % red firework \ifnum\radius<11 \draw[decorate,decoration={crosses},red!\pgfmathresult!black] (0,0) circle (\radius ex); \fi % orange firework \pgfmathparse{100-(\radius-6)*10}; \ifnum\radius>5 \ifnum\radius<16 \draw[decorate,decoration={crosses},orange!\pgfmathresult!black] (1,1) circle ( \radius ex-5ex); \fi \fi % yellow firework \pgfmathparse{100-(\radius-11)*10}; \ifnum\radius>10 \draw[decorate,decoration={crosses},yellow!\pgfmathresult!black] (2.5,1) circle (\radius ex-10ex); \fi \end{tikzpicture} } \end{document} 運行方式﹕ pdfcrop myfile.pdf convert -delay 20 -loop 0 -density 300 myfile-crop.pdf fireworks.gif M -- 來自萌氣四溢的 M 君~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 183.216.56.178

01/02 16:29, , 1F
(膜拜
01/02 16:29, 1F
文章代碼(AID): #1InCYwn2 (LaTeX)
文章代碼(AID): #1InCYwn2 (LaTeX)