如何调整单机画面以适应剧情

如何调整单机画面以适应剧情

此图表示训练用的加速包和一些其他节点。但是,编译时生成的 PDF 底部有一个空白区域:

\documentclass[border=2mm]{standalone}
\usepackage    {tikz}
\usepackage    {siunitx} % SI units, \SI and \ang commands
\usetikzlibrary{3d}      
\usetikzlibrary{babel}   % There are issues with some babel packages
\usetikzlibrary{calc}    % Computing some coordinates 
\usepackage{xcolor}
\usetikzlibrary{patterns}
\usetikzlibrary{patterns.meta}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
    
    \begin{tikzpicture}[
  pics/hook/.style={code={
    \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
    \pgfmathsetmacro{\myJacobian}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}   
    \draw[line width=\myJacobian*12pt,line cap=round]
         (0,-1) -- (0,-0.6) to[out=90,in=0] (-0.1,-0.5)
         arc[start angle=250,end angle=0,radius=0.5cm];
         }},  
  pics/bar/.style={code={\pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
    \pgfmathsetmacro{\myJacobian}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}   
   \draw[top color=black!65,
    bottom color=black!70, 
    middle color=cyan!30,
    vertical custom shading=35, rounded corners=1pt, line width=\myJacobian*2pt]
    (-0.25,-1.5) rectangle (0.25,1.5);
   \draw [fill=black] (0,0) circle[radius=1mm];}},line cap=round,>=stealth,
    declare function={alpha=15;}
    ]
        
        \def\xR{20pt}; %x radius of ellipse
        \def\yR{5pt};  %y radius of ellipse
        \def\d0{4cm};  % initial distance
        \newcommand*{\ArcAngle}{-160}%
        \newcommand*{\ArcRadius}{0.7}%
        \coordinate (Origin) at (0,-0.1);

% ceiling
        \fill [
               pattern={Lines[
                          distance=1.5mm,
                          angle=45,
                          line width=0.3mm
                         ]},
                pattern color=gray
               ] (-2.5,0) rectangle (2.5,.3);

        \draw [very thick] (-2.5, 0) -- (2.5, 0);
        
        
        % speedbag
        \begin{scope}[shift={(0,-2.2)}]

            % speedbag
            \coordinate (a) at (0,2.); % Change 1.5 to change the shape of the droplet
                \node [circle,draw,fill=blue!30!white, blue!30!white, opacity=1] (c) at (0,0) [minimum size=40pt] {};
                \draw[blue!30!white,fill=blue!30!white, opacity=1] (a) -- (tangent cs:node=c,point={(a)},solution=1) --
                (c.center) -- (tangent cs:node=c,point={(a)},solution=2) -- cycle;
            \draw [dashed]  (-\xR,0) arc[start angle=180,end angle=0,x radius=\xR,y radius=\yR]; %top half
            \draw (-\xR,0) arc[start angle=180,end angle=360,x radius=\xR,y radius=\yR]; %bottom half
            \draw[black, very thin] (0,0) --++ (\xR,0) node[pos=0.5, above] {\footnotesize h};
            \draw[black, very thin] (0,0) --++ (0,2) node[pos=0.5, left] {\footnotesize l};

            % TAG
            \draw[line width=.7ex,red!70, {Butt Cap[red!70]}-{Butt Cap[red!70]}, xshift=(\xR+.15), align=left] (0,-0.15) -- (0,0.15) 
                    node[right, pos=0.5, black] (TLAB) {};
                    
            \begin{scope}[rotate around={50:(a)}]
                \coordinate (A) at (0,2.); % Change 1.5 to change the shape of the droplet
                    \node [circle,draw,fill=blue!10!white, blue!10!white, opacity=1] (C) at (0,0) [minimum size=40pt] {};
                    \draw[blue!10!white,fill=blue!10!white, opacity=1] (A) -- (tangent cs:node=C,point={(A)},solution=1) --
                    (C.center) -- (tangent cs:node=C,point={(A)},solution=2) -- cycle;
                    %ELIPSE
                    \draw [dashed,black!60!white]  (-\xR,0) arc[start angle=180,end angle=0,x radius=\xR,y radius=\yR]; %top half
                    \draw [black!60!white] (-\xR,0) arc[start angle=180,end angle=360,x radius=\xR,y radius=\yR];
                    %TAG
                \draw[line width=.7ex,red!50, {Butt Cap[red!50]}-{Butt Cap[red!50]}, xshift=(\xR+.15), align=left] (0,-0.15) -- (0,0.15);
                
            \end{scope}
            \begin{scope}[rotate around={-60:(a)}]
                \coordinate (AA) at (0,2.); % Change 1.5 to change the shape of the droplet
                    \node [circle,draw,fill=blue!10!white, blue!10!white, opacity=1] (CC) at (0,0) [minimum size=40pt] {};
                    \draw[blue!10!white,fill=blue!10!white, opacity=1] (AA) -- (tangent cs:node=CC,point={(AA)},solution=1) --
                    (CC.center) -- (tangent cs:node=CC,point={(AA)},solution=2) -- cycle;
                    %ELIPSE
                    \draw [dashed, black!60!white]  (-\xR,0) arc[start angle=180,end angle=0,x radius=\xR,y radius=\yR]; %top half
                    \draw [black!60!white] (-\xR,0) arc[start angle=180,end angle=360,x radius=\xR,y radius=\yR];
                    %TAG
                \draw[line width=.7ex,red!50, {Butt Cap[red!50]}-{Butt Cap[red!50]}, xshift=(\xR+.15), align=left] (0,-0.15) -- (0,0.15);
            \end{scope}
            % hook
            \path (0.7,0) ++ (alpha:0.7) -- ++ (alpha-90:2.5) coordinate (H1)
               (0,2) pic[scale=0.2,gray,rotate=180]{hook};
               
            
        \end{scope}
        
        % ARC MOV
        \draw [<->, dashed] ($(Origin)+(\ArcRadius,0)$)  arc (0:\ArcAngle:\ArcRadius);
        
        % INITIAL ANTENNa
        \begin{scope}[shift={(0,-2.2)}] % Reader
            \draw[line width=.85ex,red!70, {Butt Cap[red!70]}-{Butt Cap[red!70]}, xshift=(\d0), align=left] (0,-0.35) -- (0,0.35)
                 node[above, align=left, black] (READ) {} 
                 node[pos=.5] (READ) {};
            % WAVES
            \draw[decoration={expanding waves,angle=25},decorate] ($(READ) + (0.1,0)$) --++ (-1.8,0);
        \end{scope}
    
    \end{tikzpicture}
    
\end{document}

在此处输入图片描述

我想将框架调整到方案中所代表的对象。

答案1

图像的边界框由绘制图片时使用的所有坐标的位置决定。如果边界框太大(有多余的空白),则您必须手动设置边界框(\useasboundingbox),或者必须更正绘图(如果有不必要的命令导致问题)。

您的tikzpicture包含行

            % hook
            \path (0.7,0) ++ (alpha:0.7)   -- ++ (alpha-90:2.5) coordinate (H1)
               (0,2) pic[scale=0.2,gray,rotate=180]{hook};

第一部分\path定义坐标H1。它无处可用,但位于图片底部,即空白区域的底部。此坐标是额外空间的原因。

将此代码替换为

            % hook
            \path (0,2) pic[scale=0.2,gray,rotate=180]{hook};

相关内容