利用animate宏包做粒子在磁场中运动动画
利用animate宏包做粒子在磁场中运动动画
利用animate宏包做粒子在磁场中运动动画
作品简介

\documentclass{standalone}
\usepackage{animate}
\usepackage[UTF8]{ctex}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\begin{document}
\def\r{3.64}%长半轴
\begin{animateinline}[controls=all]{9}%
\multiframe{68}{rx=180+1}{
\begin{tikzpicture}
% \coordinate (P6) at ([xshift=1cm, yshift=0] P5);
\draw[rotate around={45:(2,2)},blue] (0,0) rectangle (2,2);
\draw (-8,-6) rectangle (8,6);
\draw[-latex] (-4,0)—(6.5,0);
\foreach \i in {-3,-2.5,…,3.5,4}
\draw -latex—(\i,0);
\draw[-latex] (0,-4.5)—(0,4);
\path [draw,name path=circle1,dashed] (0,-2) circle (2);
\path [draw,name path=circle2,dashed] (\r,0) circle (\r);
\path [name intersections={of=circle1 and circle2}];
% 标注第一个交点坐标C
\coordinate [label=above:$A$] (A) at (intersection-1);
\coordinate [label=above:$B$] (B) at (intersection-2);
\draw dashed—(0:\r)—(B);
\def\a{2.5}%长半轴
\def\b{-0.3}%长半轴

\path [draw,name path=circle3,dashed] (\a,\b) circle (\r);
\path [name intersections={of=circle1 and circle3}];
% 标注第一个交点坐标C
\coordinate [label=above:$C$] (C) at (intersection-1);
\coordinate [label=above:$D$] (D) at (intersection-2);
\draw dashed—++(0:\r)—(D)—(C);
\draw dashed—++(0:\r)—(0,-2);
\draw[-latex] (C)—++(-90:1);
\draw[-latex] (A)—++(-90:1);
\fill [red] ({\a+\rcos(\rx)},{\b+\rsin(\rx)})circle (2pt); %画圆
\fill [red] ({\r+\rcos(\rx)},{\rsin(\rx)})circle (2pt);
\end{tikzpicture}}

\end{animateinline}

\end{document}

用户评论

还能输入1000字

参与评论