1

I have created now this with Mathcha but I would not have been able to create the movement of the peg placed upon the vinyl record. And this is the reason because I have asked the question: The relationship between circular motion and simple harmonic motion in LaTeX

Here there is my MWE:

    \documentclass[a4paper,12pt]{article}
    \usepackage{newtxtext,newtxmath}
    \usepackage{tikz}
    \usetikzlibrary{patterns}
    \begin{document}
% Gradient Info

\tikzset {_e96s6lwbv/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformrotate{0 }  \pgftransformscale{2 }  }}}
\pgfdeclarehorizontalshading{_1unhpm2cg}{150bp}{rgb(0bp)=(0.92,0.9,0.9);
rgb(40.267857142857146bp)=(0.92,0.9,0.9);
rgb(50.26785714285714bp)=(0.61,0.61,0.61);
rgb(60.26785714285714bp)=(0.9,0.9,0.9);
rgb(100bp)=(0.9,0.9,0.9)}

% Pattern Info

\tikzset{
pattern size/.store in=\mcSize, 
pattern size = 5pt,
pattern thickness/.store in=\mcThickness, 
pattern thickness = 0.3pt,
pattern radius/.store in=\mcRadius, 
pattern radius = 1pt}
\makeatletter
\pgfutil@ifundefined{pgf@pattern@name@_znu0qeqi8}{
\pgfdeclarepatternformonly[\mcThickness,\mcSize]{_znu0qeqi8}
{\pgfqpoint{0pt}{0pt}}
{\pgfpoint{\mcSize+\mcThickness}{\mcSize+\mcThickness}}
{\pgfpoint{\mcSize}{\mcSize}}
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{\mcThickness}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfpoint{\mcSize+\mcThickness}{\mcSize+\mcThickness}}
\pgfusepath{stroke}
}}
\makeatother

% Gradient Info

\tikzset {_l2x7lbo55/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformrotate{0 }  \pgftransformscale{2 }  }}}
\pgfdeclarehorizontalshading{_zwwqu9793}{150bp}{rgb(0bp)=(0.67,0.85,0.92);
rgb(37.5bp)=(0.67,0.85,0.92);
rgb(62.5bp)=(0.72,0.81,0.91);
rgb(100bp)=(0.72,0.81,0.91)}

% Gradient Info

\tikzset {_iixxc4hso/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformscale{1 }  }}}
\pgfdeclareradialshading{_70e8j7s84}{\pgfpoint{0bp}{0bp}}{rgb(0bp)=(0.84,0.81,0.65);
rgb(0bp)=(0.84,0.81,0.65);
rgb(21.160714285714285bp)=(0.91,0.83,0.34);
rgb(400bp)=(0.91,0.83,0.34)}

% Gradient Info

\tikzset {_qhd5d8xe7/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformscale{1 }  }}}
\pgfdeclareradialshading{_nh0a1sb98}{\pgfpoint{0bp}{0bp}}{rgb(0bp)=(0.84,0.81,0.65);
rgb(0bp)=(0.84,0.81,0.65);
rgb(21.160714285714285bp)=(0.91,0.83,0.34);
rgb(400bp)=(0.91,0.83,0.34)}

% Gradient Info

\tikzset {_e3qb8npov/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformscale{1 }  }}}
\pgfdeclareradialshading{_yaqm3gfj3}{\pgfpoint{0bp}{0bp}}{rgb(0bp)=(0.84,0.81,0.65);
rgb(0bp)=(0.84,0.81,0.65);
rgb(21.160714285714285bp)=(0.91,0.83,0.34);
rgb(400bp)=(0.91,0.83,0.34)}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,428); %set diagram left start at 0, and has height of 428

%Shape: Rectangle [id:dp11219219192531948] 
\draw  [fill={rgb, 255:red, 248; green, 248; blue, 248 }  ,fill opacity=1 ] (174.78,70.72) -- (471,164) -- (473.05,291.57) -- (176.83,198.29) -- cycle ;
%Shape: Rectangle [id:dp8571525161699813] 
\path  [shading=_1unhpm2cg,_e96s6lwbv] (176.55,133.32) -- (472.14,227.03) -- (473.05,291.57) -- (177.46,197.87) -- cycle ; % for fading 
 \draw  [dash pattern={on 0.84pt off 2.51pt}] (176.55,133.32) -- (472.14,227.03) -- (473.05,291.57) -- (177.46,197.87) -- cycle ; % for border 

%Shape: Cube [id:dp6989408399731811] 
\draw  [color={rgb, 255:red, 139; green, 87; blue, 42 }  ,draw opacity=1 ][pattern=_znu0qeqi8,pattern size=6pt,pattern thickness=0.75pt,pattern radius=0pt, pattern color={rgb, 255:red, 155; green, 82; blue, 20}] (127.04,252.31) -- (213.69,189.69) -- (391,241) -- (387.96,286.69) -- (301.31,349.31) -- (124,298) -- cycle ; \draw  [color={rgb, 255:red, 139; green, 87; blue, 42 }  ,draw opacity=1 ] (391,241) -- (304.35,303.62) -- (127.04,252.31) ; \draw  [color={rgb, 255:red, 139; green, 87; blue, 42 }  ,draw opacity=1 ] (304.35,303.62) -- (301.31,349.31) ;
%Shape: Cube [id:dp44261782922910164] 
\path  [shading=_zwwqu9793,_l2x7lbo55] (140.42,236.83) -- (225.27,175.51) -- (379,220) -- (377.83,237.62) -- (292.98,298.94) -- (139.25,254.46) -- cycle ; % for fading 
 \draw  [color={rgb, 255:red, 255; green, 255; blue, 255 }  ,draw opacity=1 ] (140.42,236.83) -- (225.27,175.51) -- (379,220) -- (377.83,237.62) -- (292.98,298.94) -- (139.25,254.46) -- cycle ; % for border 
 \draw  [color={rgb, 255:red, 255; green, 255; blue, 255 }  ,draw opacity=1 ] (379,220) -- (294.15,281.32) -- (140.42,236.83) ; \draw  [color={rgb, 255:red, 255; green, 255; blue, 255 }  ,draw opacity=1 ] (294.15,281.32) -- (292.98,298.94) ;
%Shape: Ellipse [id:dp00007934388413799454] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ][line width=2.25]  (190.59,216.97) .. controls (193.72,197.21) and (227.46,186.14) .. (265.94,192.24) .. controls (304.43,198.33) and (333.1,219.29) .. (329.97,239.05) .. controls (326.84,258.8) and (293.1,269.88) .. (254.61,263.78) .. controls (216.12,257.68) and (187.46,236.73) .. (190.59,216.97) -- cycle ;
%Shape: Ellipse [id:dp4689030903340141] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ][line width=0.75]  (196.86,216.65) .. controls (199.55,199.67) and (230.28,190.43) .. (265.51,196.01) .. controls (300.73,201.58) and (327.1,219.87) .. (324.41,236.85) .. controls (321.72,253.83) and (290.99,263.08) .. (255.77,257.5) .. controls (220.55,251.92) and (194.17,233.63) .. (196.86,216.65) -- cycle ;
%Shape: Ellipse [id:dp16070988746539716] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ][line width=0.75]  (204,217.74) .. controls (206.34,202.94) and (233.88,195) .. (265.51,200.01) .. controls (297.13,205.01) and (320.87,221.07) .. (318.52,235.88) .. controls (316.18,250.68) and (288.64,258.62) .. (257.02,253.61) .. controls (225.39,248.6) and (201.65,232.54) .. (204,217.74) -- cycle ;
%Shape: Ellipse [id:dp9029753738197073] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][line width=0.75]  (220.48,220.77) .. controls (221.87,210.5) and (240.78,204.58) .. (262.72,207.54) .. controls (284.66,210.5) and (301.33,221.23) .. (299.94,231.5) .. controls (298.55,241.77) and (279.64,247.69) .. (257.7,244.73) .. controls (235.76,241.77) and (219.09,231.04) .. (220.48,220.77) -- cycle ;
%Shape: Ellipse [id:dp23388780189398362] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][line width=0.75]  (210.93,218.33) .. controls (212.86,206.14) and (236.48,199.76) .. (263.7,204.07) .. controls (290.92,208.38) and (311.42,221.76) .. (309.49,233.94) .. controls (307.56,246.12) and (283.93,252.51) .. (256.72,248.19) .. controls (229.5,243.88) and (209,230.51) .. (210.93,218.33) -- cycle ;
%Shape: Ellipse [id:dp24232637107174337] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][line width=0.75]  (226.78,220.5) .. controls (228.23,211.76) and (244.54,207.19) .. (263.21,210.29) .. controls (281.88,213.39) and (295.84,222.99) .. (294.39,231.73) .. controls (292.94,240.47) and (276.62,245.04) .. (257.95,241.94) .. controls (239.28,238.84) and (225.32,229.24) .. (226.78,220.5) -- cycle ;
%Shape: Ellipse [id:dp8298756923891446] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 248; green, 231; blue, 28 }  ,fill opacity=1 ][line width=0.75]  (228.78,220.5) .. controls (229.97,212.96) and (244.86,209.05) .. (262.02,211.76) .. controls (279.19,214.48) and (292.14,222.8) .. (290.94,230.35) .. controls (289.75,237.89) and (274.86,241.8) .. (257.7,239.08) .. controls (240.53,236.37) and (227.58,228.05) .. (228.78,220.5) -- cycle ;
%Shape: Can [id:dp3180414705255403] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (256.57,213.26) -- (256.57,227.17) .. controls (256.57,227.7) and (258.05,228.13) .. (259.89,228.13) .. controls (261.72,228.13) and (263.21,227.7) .. (263.21,227.17) -- (263.21,213.26) .. controls (263.21,212.73) and (261.72,212.29) .. (259.89,212.29) .. controls (258.05,212.29) and (256.57,212.73) .. (256.57,213.26) .. controls (256.57,213.8) and (258.05,214.23) .. (259.89,214.23) .. controls (261.72,214.23) and (263.21,213.8) .. (263.21,213.26) ;
%Shape: Can [id:dp3814217371586581] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 155; green, 155; blue, 155 }  ,fill opacity=1 ] (311.68,162.16) -- (311.68,176.06) .. controls (311.68,176.6) and (313.17,177.03) .. (315.01,177.03) .. controls (316.84,177.03) and (318.33,176.6) .. (318.33,176.06) -- (318.33,162.16) .. controls (318.33,161.62) and (316.84,161.19) .. (315.01,161.19) .. controls (313.17,161.19) and (311.68,161.62) .. (311.68,162.16) .. controls (311.68,162.69) and (313.17,163.13) .. (315.01,163.13) .. controls (316.84,163.13) and (318.33,162.69) .. (318.33,162.16) ;
%Shape: Can [id:dp9354524854309667] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 226; green, 226; blue, 226 }  ,fill opacity=1 ] (249.68,143.16) -- (249.68,157.06) .. controls (249.68,157.6) and (251.17,158.03) .. (253.01,158.03) .. controls (254.84,158.03) and (256.33,157.6) .. (256.33,157.06) -- (256.33,143.16) .. controls (256.33,142.62) and (254.84,142.19) .. (253.01,142.19) .. controls (251.17,142.19) and (249.68,142.62) .. (249.68,143.16) .. controls (249.68,143.69) and (251.17,144.13) .. (253.01,144.13) .. controls (254.84,144.13) and (256.33,143.69) .. (256.33,143.16) ;
%Shape: Can [id:dp91279778337644] 
\draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ][fill={rgb, 255:red, 226; green, 226; blue, 226 }  ,fill opacity=1 ] (379.68,184.16) -- (379.68,198.06) .. controls (379.68,198.6) and (381.17,199.03) .. (383.01,199.03) .. controls (384.84,199.03) and (386.33,198.6) .. (386.33,198.06) -- (386.33,184.16) .. controls (386.33,183.62) and (384.84,183.19) .. (383.01,183.19) .. controls (381.17,183.19) and (379.68,183.62) .. (379.68,184.16) .. controls (379.68,184.69) and (381.17,185.13) .. (383.01,185.13) .. controls (384.84,185.13) and (386.33,184.69) .. (386.33,184.16) ;
%Shape: Can [id:dp5959842751554034] 
\path  [shading=_70e8j7s84,_iixxc4hso] (198.57,194.26) -- (198.57,208.17) .. controls (198.57,208.7) and (200.05,209.13) .. (201.89,209.13) .. controls (203.72,209.13) and (205.21,208.7) .. (205.21,208.17) -- (205.21,194.26) .. controls (205.21,193.73) and (203.72,193.29) .. (201.89,193.29) .. controls (200.05,193.29) and (198.57,193.73) .. (198.57,194.26) .. controls (198.57,194.8) and (200.05,195.23) .. (201.89,195.23) .. controls (203.72,195.23) and (205.21,194.8) .. (205.21,194.26) ; % for fading 
 \draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ] (198.57,194.26) -- (198.57,208.17) .. controls (198.57,208.7) and (200.05,209.13) .. (201.89,209.13) .. controls (203.72,209.13) and (205.21,208.7) .. (205.21,208.17) -- (205.21,194.26) .. controls (205.21,193.73) and (203.72,193.29) .. (201.89,193.29) .. controls (200.05,193.29) and (198.57,193.73) .. (198.57,194.26) .. controls (198.57,194.8) and (200.05,195.23) .. (201.89,195.23) .. controls (203.72,195.23) and (205.21,194.8) .. (205.21,194.26) ; % for border 

%Curve Left Arrow [id:dp4586721397182332] 
\draw  [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (174.96,230.68) .. controls (173.57,221.36) and (179.52,212.71) .. (188.26,211.38) -- (188.32,211.8) .. controls (179.59,213.14) and (173.63,221.78) .. (175.03,231.1) ;\draw  [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (175.03,231.1) .. controls (175.83,236.48) and (178.9,240.91) .. (183.04,243.44) -- (183.61,247.3) -- (193.33,245.34) -- (182.39,239.15) -- (182.97,243.01) .. controls (178.84,240.49) and (175.76,236.06) .. (174.96,230.68)(175.03,231.1) -- (174.96,230.68) ;
%Straight Lines [id:da36438391810809145] 
\draw    (185.77,35.33) -- (487.59,130.37) ;
\draw [shift={(490.45,131.27)}, rotate = 197.48] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle    ;
%Straight Lines [id:da6105386313883943] 
\draw    (338.11,83.3) -- (353.11,69.3) ;
%Straight Lines [id:da18303073174683426] 
\draw    (412,106) -- (427,92) ;
%Straight Lines [id:da2554028578787002] 
\draw    (270.11,61.3) -- (285.11,47.3) ;
%Shape: Can [id:dp5166414046947045] 
\path  [shading=_nh0a1sb98,_qhd5d8xe7] (318.52,235.88) -- (318.52,249.78) .. controls (318.52,250.31) and (320.01,250.75) .. (321.85,250.75) .. controls (323.68,250.75) and (325.17,250.31) .. (325.17,249.78) -- (325.17,235.88) .. controls (325.17,235.34) and (323.68,234.91) .. (321.85,234.91) .. controls (320.01,234.91) and (318.52,235.34) .. (318.52,235.88) .. controls (318.52,236.41) and (320.01,236.85) .. (321.85,236.85) .. controls (323.68,236.85) and (325.17,236.41) .. (325.17,235.88) ; % for fading 
 \draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ] (318.52,235.88) -- (318.52,249.78) .. controls (318.52,250.31) and (320.01,250.75) .. (321.85,250.75) .. controls (323.68,250.75) and (325.17,250.31) .. (325.17,249.78) -- (325.17,235.88) .. controls (325.17,235.34) and (323.68,234.91) .. (321.85,234.91) .. controls (320.01,234.91) and (318.52,235.34) .. (318.52,235.88) .. controls (318.52,236.41) and (320.01,236.85) .. (321.85,236.85) .. controls (323.68,236.85) and (325.17,236.41) .. (325.17,235.88) ; % for border 

%Straight Lines [id:da8007660488735489] 
\draw  [dash pattern={on 4.5pt off 4.5pt}]  (318.33,176.06) -- (288.45,202.58) ;
%Shape: Can [id:dp8663586030331742] 
\path  [shading=_yaqm3gfj3,_e3qb8npov] (285.57,189.26) -- (285.57,203.17) .. controls (285.57,203.7) and (287.05,204.13) .. (288.89,204.13) .. controls (290.72,204.13) and (292.21,203.7) .. (292.21,203.17) -- (292.21,189.26) .. controls (292.21,188.73) and (290.72,188.29) .. (288.89,188.29) .. controls (287.05,188.29) and (285.57,188.73) .. (285.57,189.26) .. controls (285.57,189.8) and (287.05,190.23) .. (288.89,190.23) .. controls (290.72,190.23) and (292.21,189.8) .. (292.21,189.26) ; % for fading 
 \draw  [color={rgb, 255:red, 155; green, 155; blue, 155 }  ,draw opacity=1 ] (285.57,189.26) -- (285.57,203.17) .. controls (285.57,203.7) and (287.05,204.13) .. (288.89,204.13) .. controls (290.72,204.13) and (292.21,203.7) .. (292.21,203.17) -- (292.21,189.26) .. controls (292.21,188.73) and (290.72,188.29) .. (288.89,188.29) .. controls (287.05,188.29) and (285.57,188.73) .. (285.57,189.26) .. controls (285.57,189.8) and (287.05,190.23) .. (288.89,190.23) .. controls (290.72,190.23) and (292.21,189.8) .. (292.21,189.26) ; % for border 

%Straight Lines [id:da5225881545731741] 
\draw  [dash pattern={on 4.5pt off 4.5pt}]  (253.01,158.03) -- (199.89,209.13) ;
%Straight Lines [id:da19657973147412733] 
\draw  [dash pattern={on 4.5pt off 4.5pt}]  (385,202) -- (325.17,249.78) ;

% Text Node
\draw (259.66,17.66) node [anchor=north west][inner sep=0.75pt]  [rotate=-17.91,xslant=-0.28]  {$x=-A$};
% Text Node
\draw (411.66,65.66) node [anchor=north west][inner sep=0.75pt]  [rotate=-17.91,xslant=-0.28]  {$x=+A$};
% Text Node
\draw (337.66,43.66) node [anchor=north west][inner sep=0.75pt]  [rotate=-17.91,xslant=-0.28]  {$x=0$};
% Text Node
\draw (492.21,135.41) node [anchor=north west][inner sep=0.75pt]  [rotate=-17.91,xslant=-0.28]  {$x$};


\end{tikzpicture}
\end{document}

enter image description here

Just it is onlyu a curiosity: is it possible to animate my code? Otherwise is it possible to animate a code created with Mathcha?

DDS
  • 8,816
  • 4
  • 9
  • 36
Sebastiano
  • 54,118
  • 2
    Probably not, if using Mathcha. Matchcha's TikZ output is a projection of a 3D scene onto the page's 2D coordinate system. This makes it nearly impossible to parameterize the graphics code w. resp. to the moving objects on the turntable. You might reproduce the graphic manually, using TikZ's 3D coordinate system. – AlexG Feb 04 '21 at 14:37
  • @AlexG Very kind Alex you're a very good user. Hence is not possible to animate my peg? – Sebastiano Feb 04 '21 at 20:24
  • Why don't you use Pumuckl's answer. It has almost everything, you just have to add the record player's body, a simple cuboid. – AlexG Feb 04 '21 at 20:39
  • @AlexG Yes yes, of course I'm using the Pumuckl's answer. Really my question it is to understand if the code done with Mathcha can be animate. IMHO my graph is beautiful :-) and it has been necessary many time to make it. – Sebastiano Feb 04 '21 at 20:44

0 Answers0