Guest User

Untitled

a guest
Oct 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.83 KB | None | 0 0
  1. documentclass{standalone}
  2.  
  3. usepackage{tikz}
  4. usetikzlibrary{positioning}
  5. usepackage{animate}
  6. usepackage{xsavebox}
  7. usepackage{pgf}
  8.  
  9. begin{document}
  10. newcommandXA{1}
  11. newcommandYA{10}
  12. newcommandLengthProbe{3.5}
  13. newcommandwidthProbe{0.5}
  14. newcommandcontactPoint{0.1}
  15. newcommandneuronX{3}
  16. newcommandneuronY{8.5}
  17. newcommandneuronYTwo{3.5}
  18. gdefoldy{0}
  19.  
  20.  
  21. %empty first frame:
  22. xsbox{mygraph}{tikz path[use as bounding box] (0,0) rectangle (11.5,12);}%
  23. makebox[0pt][l]{xusebox{mygraph}}%
  24.  
  25. xsbox{mygraph}{%
  26. begin{tikzpicture}
  27.  
  28. path[use as bounding box] (0,0) rectangle (11.5,12);
  29. draw (XA,YA) -- (XA,YA-LengthProbe) -- (XA+widthProbe,YA-LengthProbe -widthProbe) --(XA+widthProbe,YA) -- (XA,YA); %linear probes
  30.  
  31. foreach gx in {0}{ %contact point on the first linear probe
  32. foreach ix in {1,3}
  33. draw (XA+0.1,YA-ix+gx) rectangle (XA+contactPoint+0.1,YA-ix-contactPoint+gx);
  34. foreach ix in {0,2}
  35. draw (XA+0.3,YA-ix-0.2+gx) rectangle (XA+contactPoint+0.3,YA-ix-contactPoint-0.2+gx);
  36. }
  37.  
  38. node[] at (10.5,9.5) {Channel 1};
  39. node[] at (10.5,8.5) {Channel 2};
  40. node[] at (10.5,7.5) {Channel 3};
  41. node[] at (10.5,6.5) {Channel 4};
  42.  
  43. node [circle,draw] at (neuronX,neuronY) (N1) {};
  44. node [circle,draw,below right = 0.2cm and 0.2cm of N1] () {};
  45. node [circle,draw,below right = 0.15cm and -0.2cm of N1] () {};
  46. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  47. node [circle,draw,above right = 0.05cm and 0.2cm of N1] () {};
  48. node [circle,draw,below right = 0.8cm and 0.3cm of N1] () {};
  49. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  50. node [circle,draw,below right = 1.2cm and 0.2cm of N1] () {};
  51. node [circle,draw,below left = 1.4cm and 0.0cm of N1] () {};
  52.  
  53. node[yshift = 10.5cm,xshift = 3.5cm] () {Before Optimisation};
  54.  
  55. coordinate (A1) at (2.5,10);
  56. coordinate (B1) at (2,6);
  57. coordinate (A2) at (4 , 10);
  58. coordinate (B2) at (4.5 , 6);
  59.  
  60.  
  61. end{tikzpicture}
  62.  
  63. %repeat previous graph
  64. makebox[0pt][l]{xusebox{mygraph}}%
  65. }
  66.  
  67. begin{animateinline}[controls]{8}
  68.  
  69. xusebox{mygraph}
  70. newframe
  71. multiframe{30}{rx=6.9+0.05}{%
  72. pgfmathsetmacro{y}{0.1*rand}%
  73. xsbox{mygraph}{%
  74. %repeat previous graph
  75.  
  76. makebox[0pt][l]{xusebox{mygraph}}%
  77. %append new line segment
  78. begin{tikzpicture}
  79.  
  80. foreach x in {-1,0,1,2}{
  81. path[use as bounding box] (0,0) rectangle (11.5,12);
  82. pgfmathsetmacro{oldx}{rx-0.05}
  83. ifdim 7.3pt < rx pt relax
  84. ifdim 7.8pt > rx ptrelax
  85. draw [red,line cap=round] (oldx,oldy+7.6+x) -- (rx,y+7.6+x);
  86. node[yshift = 10.5cm,xshift = 7.5cm] () {Light Pulse};
  87. shade[top color=orange,bottom color=orange,middle color = red,fill opacity=0.4] (A2) to [bend right=10] (B2) to [] (B1) to [bend right=10] (A1) to (A2);
  88. node [circle,draw] at (neuronX,neuronY) (N1) {};
  89. node [circle,draw,below right = 0.2cm and 0.2cm of N1] () {};
  90. node [circle,draw,below right = 0.15cm and -0.2cm of N1] () {};
  91. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  92. node [circle,draw,above right = 0.05cm and 0.2cm of N1] () {};
  93. node [circle,draw,below right = 0.8cm and 0.3cm of N1] () {};
  94. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  95. node [circle,draw,below right = 1.2cm and 0.2cm of N1] () {};
  96. node [circle,draw,below left = 1.4cm and 0.0cm of N1] () {};
  97. else
  98. draw [line cap=round] (oldx,oldy+7.3+x) -- (rx,y+7.3+x);
  99. shade[top color=white,bottom color=white,middle color = white] (A2) to [bend right=10] (B2) to [] (B1) to [bend right=10] (A1) to (A2);
  100. node [circle,draw] at (neuronX,neuronY) (N1) {};
  101. node [circle,draw,below right = 0.2cm and 0.2cm of N1] () {};
  102. node [circle,draw,below right = 0.15cm and -0.2cm of N1] () {};
  103. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  104. node [circle,draw,above right = 0.05cm and 0.2cm of N1] () {};
  105. node [circle,draw,below right = 0.8cm and 0.3cm of N1] () {};
  106. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  107. node [circle,draw,below right = 1.2cm and 0.2cm of N1] () {};
  108. node [circle,draw,below left = 1.4cm and 0.0cm of N1] () {};
  109. fi
  110. else
  111. draw [line cap=round] (oldx,oldy+7.3+x) -- (rx,y+7.3+x);
  112. shade[top color=white,bottom color=white,middle color = white]
  113. (A2) to [bend right=10] (B2) to [] (B1) to [bend right=10] (A1) to
  114. (A2);
  115. node [circle,draw] at (neuronX,neuronY) (N1) {};
  116. node [circle,draw,below right = 0.2cm and 0.2cm of N1] () {};
  117. node [circle,draw,below right = 0.15cm and -0.2cm of N1] () {};
  118. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  119. node [circle,draw,above right = 0.05cm and 0.2cm of N1] () {};
  120. node [circle,draw,below right = 0.8cm and 0.3cm of N1] () {};
  121. node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
  122. node [circle,draw,below right = 1.2cm and 0.2cm of N1] () {};
  123. node [circle,draw,below left = 1.4cm and 0.0cm of N1] () {};
  124. fi
  125. }
  126.  
  127.  
  128. end{tikzpicture}%
  129. }%
  130. xusebox{mygraph}%
  131. xdefoldy{y}%
  132. }
  133.  
  134. end{animateinline}
  135.  
  136. end{document}
Add Comment
Please, Sign In to add comment